embedded

Unit Testing Embedded Software [closed]

ぃ、小莉子 提交于 2019-11-29 19:14:11
What best practices have you used in unit testing embedded software that are peculiar to embedded systems? Embedded software may have come a long way in the last 10 years but we generally did the following: for algorithms that didn't depend on the target hardware, we simply had unit tests that were built and tested on a non-embedded platform. for stuff that did require the hardware, unit tests were conditionally compiled into the code to use whatever hardware was available. In our case, it was a serial port on the target pushing the results to another, more capable, machine where the tests

Is there a way to load a binary file as a const variable in C at compile time

空扰寡人 提交于 2019-11-29 19:02:47
问题 I was wondering if there is a way to load an external binary file as a variable in C through an include or a header file or something of the like. For example, in a project I am currently working on I am working with an embedded system that has a graphic display that will do text and minor graphics (boxes, lines, etc.) using ASCII data and commands. But, it will also display monochrome bitmaps. So I have a series of static displays that I use for a user interface, and a couple of bitmaps for

Convert unix timestamp to date without system libs

北战南征 提交于 2019-11-29 18:43:21
问题 I am building a embedded project which displays the time retrieved from a GPS module on a display, but I would also like to display the current date. I currently have the time as a unix time stamp and the progject is written in C. I am looking for a way to calculate the current UTC date from the timestamp, taking leap years into account? Remember, this is for an embedded project where there is no FPU, so floating point math is emulated, avoiding it as much as possible for performance is

Sorting 1 million 8-digit numbers in 1 MB of RAM

霸气de小男生 提交于 2019-11-29 18:30:33
I have a computer with 1 MB of RAM and no other local storage. I must use it to accept 1 million 8-digit decimal numbers over a TCP connection, sort them, and then send the sorted list out over another TCP connection. The list of numbers may contain duplicates, which I must not discard. The code will be placed in ROM, so I need not subtract the size of my code from the 1 MB. I already have code to drive the Ethernet port and handle TCP/IP connections, and it requires 2 KB for its state data, including a 1 KB buffer via which the code will read and write data. Is there a solution to this

How to determine maximum stack usage in embedded system?

守給你的承諾、 提交于 2019-11-29 18:25:57
问题 When I give the Keil compiler the "--callgraph" option, it statically calculates the exact "Maximum Stack Usage" for me. Alas, today it is giving me a "Maximum Stack Usage = 284 bytes + Unknown(Functions without stacksize...)" message, along with a list of "Functions with no stack information". Nigel Jones says that recursion is a really bad idea in embedded systems ("Computing your stack size" 2009), so I've been careful not to make any mutually recursive functions in this code. Also, I make

How can I use an SD card for logging 16-bit data at 48 ksamples/s?

感情迁移 提交于 2019-11-29 17:38:36
问题 Background My board incorporates an STM32 microcontroller with an SD/MMC card on SPI and samples analogue data at 48 ksamples/s. I am using the Keil Real-time Library RTX kernel, and ELM FatFs. I have a high priority task that captures analogue data via DMA in blocks of 40 samples (40 x 16 bit); the data is passed via a queue of length 128 (which constitutes about 107 ms of sample buffering) to a second low priority task that collates sample blocks into a 2560 byte buffer (this being a

Slight Delay After Returning from Interrupt

牧云@^-^@ 提交于 2019-11-29 17:01:07
I've written a small program that uses a button on an STM32 Discovery board to act as a counter in either Binary/Decimal/Hexadecimal mode (screen cycles through the 3 options and once pressed, counts up to 16 for each press before resetting to cycling through options). I'm encountering one small "bug" (read, not really) that has me a little confused. If I count up in Decimal/Hexadecimal, it returns to cycling through the options immediately but if I have counted up in Binary it takes ~1sec or so before doing so (a noticeable delay). int main(void) { RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6,

Monitoring pthread context switching

限于喜欢 提交于 2019-11-29 16:05:46
I would like to monitor the the context switching behavior in a multi-threaded pthread application. In other RTOSes(Micro C OS) I have been able to register a context switch callback for each thread in the application, and then log (or toggle a gpio) and watch the thread context switching in real time. This was a valuable tool for debugging the real time behavior and interaction of the multiple threads. My current environment is embedded linux utilizing the pthread api. Is there a way to monitor each of the context switches? Not in the way you describe, however there are various profiling

Qt/Embedded for Linux 应用开发案例

你。 提交于 2019-11-29 15:55:16
一、开发环境的构建 1.下载Qt源代码,包括桌面版和嵌入式版 如4.7.4版:qt-everywhere-opensource-src-4.7.4.tar.gz qt-everywhere-opensource-src-4.7.4[embedded].tar.gz 解压缩到当前目录:tar -xzvf qt-everywhere-opensource-src-4.7.4.tar.gz 2.编译安装桌面版和嵌入式版 桌面版一般为默认配置安装:./configure ; sudo make; sudo make install; 嵌入式版安装作为开发用,也一般可以为默认安装,但必须指定目标类型与主机类型 (1) 首先需要指定目标类型,利用现有的或者修改、添加目标类型 a.进入mkspecs/qws/文件夹中:cd mkspecs/qws b.找到你的目标类型文件夹并且拷贝一份:cp linux-arm-g++ linux-omapl138-g++ -a c.进入你的目标文件夹中以修改qmake.conf配置文件,主要是修改交叉编译器: cd linux-omapl138-g++;gedit qmake.conf 修改文件中的如下内容以符合你的交叉开发环境: # modifications to g++.conf QMAKE_CC = arm-none-linux-gnueabi-gcc

Device tree compiler not recognizes C syntax for include files

流过昼夜 提交于 2019-11-29 15:50:57
问题 I want to compile my board device tree manually. I has downloaded the latest version of dtc from its official source, but when I try to run the following command, I get an error advising me to change all #include directives to /include/ and so on for #define , etc. dtc -I dts -O dtb -p 0x1000 meson-gxl-s905x-khadas-vim.dts -o kvim1.dtb My board is Khadas Vim with an amlogic S905x SoC in its heart. All include files are present and the error is: Error: meson-gxl-s905x-khadas-vim.dts:8.1-9