Hardfault Systeminit STM32Cube_FW_F0_V1.2.0
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 1:18 AM
Posted on February 02, 2015 at 10:18
Hi,
Using the STM32F0308-DISCO eval board and the STM32Cube_FW_F0_V1.2.0I am compliling using eclipse and GCC ARM Sourcery tools with openOCD debugger.The GPIO_IOToggle example compiles, loads and runs in the debugger but I get a hard fault on the first line of the SystemInit function:void SystemInit(void){ /* Reset the RCC clock configuration to the default reset state ------------*/ /* Set HSION bit */ RCC->CR |= (uint32_t)0x00000001;The hard fault occurs at the read from the RCC control register. The disassembly is below.163 RCC->CR |= (uint32_t)0x00000001;0800020c: ldr r3, [pc, &sharp116] ; (0x8000284 <SystemInit+124>)0800020e: ldr r2, [pc, &sharp116] ; (0x8000284 <SystemInit+124>)08000210: ldr r2, [r2, &sharp0] <<<<<<--------- Hardfault here08000212: orr.w r2, r2, &sharp108000216: str r2, [r3, &sharp0]I am using all the latest code from the CUBE firmware.Anybody got any ideas?????ThanksMPC #stm32f0 #stm32cube
Labels:
- Labels:
-
STM32Cube MCU Packages
-
STM32F0 Series
This discussion is locked. Please start a new topic to ask your question.
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 4:50 AM
Posted on February 02, 2015 at 13:50
And R2 is what? Are you sure you're building the code for a Cortex-M0 cpu?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 5:47 AM
Posted on February 02, 2015 at 14:47
> And R2 is what?
In other words, what is the content of R2 at that moment? JWOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 9:55 AM
Posted on February 02, 2015 at 18:55
Hi,
r2 holds the address of the RCC control register 0x8000340. I have the target processor set to cortex-m0 and the -mthumb flag set. I am using codesourcery 4.7.3 I did try to put the routine into the startup code as belowldr r2, =#0x8000340 ldr r3, =#0x8000340 ldr r2,[r2,#0] orr.w r2,r2,#1 str r2, [r3,#0]But the assembler through it out saying:Error: selected processor does not support Thumb-2 mode `orr.w r2,r2,#1'So it does look like the compiler is not producing thumb code but why?MPCOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 10:08 AM
Posted on February 02, 2015 at 19:08
Hi,
Checking the console I see the flags have changedI get -mcpu=cortex-m4But in the project properties I have the target processor set to cortex-m0. This is very strange.MPCOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 10:16 AM
Posted on February 02, 2015 at 19:16
hi,
The src folder had a wrench next to it. This indicates the properties are different from the project.Setting this back to the default, I now get the correct flag, -mcpu=cortex-m0. Completely clueless how this happened.MPCOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 10:37 AM
Posted on February 02, 2015 at 19:37
Odd.
0x8000340 is a FLASH address by the way, most likely the location of the literal pool which it's loading the actual value.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
