embedded

Core Coupled Memory executable on STM32F4xx?

醉酒当歌 提交于 2019-12-13 02:33:59
问题 Trying to run code from a STM32F429s CCM but I always get a Hard Fault with the IBUSERR flag set as soon as I hit the first instruction in the CCM. The instruction is valid and well aligned. Is it possible that the STM32F4xx does not allow execution from the CCM? (Data access works well). alios 回答1: The CCM in these parts is only connected to the data bus. Instructions cannot be fetched from this memory -- only flash memory, SRAM1, and external memory should be used for code. For more

sprintf corrupting arrays in IAR microcontroller

不羁的心 提交于 2019-12-13 01:26:36
问题 I am currently learning embedded programming, and thus working on an IAR-platform using a TI microcontroller with ARM architecture. Since I am not at all familiar with the technicalities related to this kind of programming, or C programming in general, I would like to ask a basic question: I have the following simple code snippet: int i; for(i = 0; i < NUM_SAMPLES; i++) { sinTable[i] = sinf(2*i*dT*PI); } for(i = 0; i < NUM_SAMPLES; i++) { char out[32]; sprintf(out,"sin: %.7f, %.7f;", i*dT,

PC value in between two instructions (program counter)

霸气de小男生 提交于 2019-12-13 01:13:18
问题 Trying to understand the cause of the watchdog. The snippet of assembly routine is as follows: fe813cf0: 2820 cmp r0, #32 fe813cf2: dbf0 blt.n fe813cd6 <XYZ+0x10> fe813cf4: f04f 30ff mov.w r0, #4294967295 ; 0xffffffff fe813cf8: bd10 pop {r4, pc} My PC value from dump is fe813cf3. What does this mean? How should I interpret it? Please let me know if more info is required. 回答1: If it's a watchdog that triggers, that seems to indicate that the processor has hung. The state you're capturing might

divide by zero exception in ARM OMAP3515 processor

不想你离开。 提交于 2019-12-12 22:00:26
问题 I am using OMAP3515 processor (Generic CortexA8 Device) for my project, I was working on exception handling but this processor dos not generate any exception when any divide by zero instruction is given , it simply goes not next instruction. I want to know whether any configuration available to generate divide by zero exception. 回答1: Cortex A8 does not support divide-by-zero for integer operations. Other than normal interrupts and debug exceptions, the only fault exceptions supported are data

Segmentation fault caused/avoided by changing source file order in Makefile

别说谁变了你拦得住时间么 提交于 2019-12-12 21:37:05
问题 I'm developing software on an embedded platform and keep getting inexplicable (to me) segmentation faults. I was hoping to get some debugging ideas from those of you with more embedded platform experience. I couldn't find any useful information with a google search. Details: C++ compiled with GCC-ARM toolchain (4.9.3) ARM Cortex-M3 processor (on a LPC1768 dev board, if you're curious) I can prevent the segmentation fault by modifying the build order of the source files (i.e., file order in

printf support for MSP430 micro-controller

你。 提交于 2019-12-12 18:28:27
问题 I am upgrading a fully tested C program for the Texas Instruments (TI) MSP430 micro-controller using a different C compiler, changing from the Quadravox, AQ430 Development Tool to the VisualGDB C compiler. The program compiles with zero errors and zero warnings with VisualGDB. The interrupt service routines, timers, UART control, and more all seem to be working. Certain uses of sprintf, however, are not working. For example: unsigned int duration; float msec; msec = (float)duration; msec =

Fastest array lookup algorithm in C for embedded system?

谁说我不能喝 提交于 2019-12-12 17:51:59
问题 Let's say I have a constant array of floats with defined size 22 that looks like this: array[0]= 0; array[1]= 0.5; array[2]= 0.7; array[3]= 1.8; ... ... array[21]= 4.2; The values of this array are monotonic, this is, they always increase with the index ( array[0]<=array[1]<=array[2]<=....<=array[21] ). And I want a function that given a float, it finds the index of the array whose value is immediately below the input float (and thus, the value of the next index is immediately above) For

Where all to use volatile keyword in C

大憨熊 提交于 2019-12-12 16:24:42
问题 I know volatile keyword prevents compiler from optimizing a variable and read it from memory whenever it is read. Apart from memory mapped registers, what are all the situations where we need to use volatile? Given a conforming compiler, do I have to declare test_var as volatile in both scenarios? 1. In file1.c int test_var=100; void func1() { test_var++; } In file2.c extern int test_var; void func2() { if(test_var==100) { .... } } 2. In file1.c int test_var=100; void func1() { } In file2.c

c++ std::atomic<bool>::fetch_or not implemented?

橙三吉。 提交于 2019-12-12 16:19:52
问题 With this excerpt of code: class myclass { volatile std::atomic<bool> flag; public: myclass(): flag(false) {} bool get_flag() { return flag; } bool try_set() { return !flag.fetch_or(flag, true); } void reset() { flag = false; } }; I am having this compile error: error: ‘volatile struct std::atomic<bool>’ has no member named ‘fetch_or’ return !flag.fetch_or(flag, true); It compiles if, however, I change the template parameter to int : class myclass { volatile std::atomic<int> flag; public:

PIC16F883 Led Blink

本秂侑毒 提交于 2019-12-12 16:07:27
问题 I need to program a PIC16F883 to blink / light up LED's at the same time. The oscillator is running at 3,2768, and I'm using TIMER0 to help me with the timing. Right now, I have a prescaler set to 1:256, so I get an interrupt every 50ms, and I have a variable that is calculated from that, to display how many seconds has gone. If the input is changed, the seconds variable is of course reset again. Here is the assignment from my teacher: If Input is 0 (Closed): The Red And The Green LED should