problem with standard libraries on STM32F100RB
hi and thanks for the toolchain!
i appear to have a a problem including any of the C standard libraries in my project.
apologies in advance if this is caused by my lack of understanding rather than this toolchain.
the target:
i am using an old STM32VLDISCOVERY dev board from my parts bin.
http://
this uses the STM32F100RB core.
i am using ST's source files, linker script, etc from here:
http://
i am building on Linux and using https:/
the problem:
lets use memset() as an example.
when i include string.h and use memset() to set more than 1 byte in my code everything appears to build ok,
however the target STM32 goes to the HardFault_Handler interrupt handler.
minimal code example, main.c:
#include "stm32f10x.h"
#include "STM32vldiscove
#include <string.h>
int main(void){
STM32vldisc
STM32vldisc
STM32vldisc
STM32vldisc
char test[12];
memset(test, 0, 2);
STM32vldisc
while(1){
}
}
linker command line:
duncan@
/home/duncan/
/home/duncan/
/home/duncan/
gdb output and source file snippets:
(gdb) run
Starting program: /home/duncan/
^CHardFault_Handler () at stm32f10x_it.c:59
59 }
(gdb) bt
#0 HardFault_Handler () at stm32f10x_it.c:59
#1 <signal handler called>
#2 0x080012fe in GPIO_Init (GPIOx=0x20001ff0, GPIO_InitStruct
#3 0x08001e36 in ?? ()
#4 0x08001e36 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
duncan@
49 /**
50 * @brief This function handles Hard Fault exception.
51 * @param None
52 * @retval None
53 */
54 void HardFault_
55 {
56 /* Go to infinite loop when Hard Fault exception occurs */
57 while (1)
58 {
59 }
60 }
duncan@
181 /*-----
182 currentmode = ((uint32_
183 if ((((uint32_
184 {
185 /* Check the parameters */
186 assert_
187 /* Output mode */
188 currentmode |= (uint32_
189 }
TBH, i'm a little out of my depth here.
it appears to me reading the value of "GPIO_InitStruc
interestingly, if i only memset() a single byte (eg, "memset(test, 0, 1)") the program runs as intended...
i suspect my Makefile is including the wrong standard libraries at link time...
any thoughts appreciated.
thanks,
dunk.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- dunk
- Solved:
- Last query:
- Last reply: