cancel
Showing results for 
Search instead for 
Did you mean: 

IAR EWARM project doesn't run with STM32 startup file

amayberr
Associate
Posted on July 01, 2013 at 18:05

I'm attempting to test out some basic programs on an STM32L151RD (Cortex-M3) using IAR's Embedded Workbench. I'm using an ST-LINK/V2 programmer. I've downloaded the Standard Peripherals Library and generally have been able to get it working, with one exception. For some reason, if I use the provided startup file ''startup_stm32l1xx_hd.s'' the MCU just hangs when I load the program, and I end up having to use the ST-LINK Utility software to reset the MCU.

At first I thought the solution was to just not use the startup file, figuring that IAR must've included it (or something equivalent) automatically elsewhere since it compiles, loads, and runs just fine without it. That was fine until I needed to use an interrupt handler for a simple SysTick program, and of course since all of the interrupt handlers are supposed to be defined in the startup file (as I understand it), SysTick doesn't work.

Just to clarify, by ''include'' the startup file, I just added it to the project source like I would a .c file. If there's some other project setting I need to point to the startup file, I haven't found it.

I've looked over the list of all the files I need to include and compared against the template project, so far as I can tell I'm doing everything right. I'm new to both ARM and IAR, if anyone has any simple things I should check or any feedback on what might be wrong I'd greatly appreciate it.

1 REPLY 1
Posted on July 01, 2013 at 20:21

The startup file, or an equivalent, is required to architect the structures required by the CPU to recognize how to start execution, and service interrupts. You could take a look at the ARM docs for the core, or for a slightly different perspective Joseph Yiu's book.

The startup and system files have expectations about the board and CPU, if these don't mirror your set up, what ever that is, then things will likely fall over during initialization.

In things like Keil one can step the code from ResetHandler onward (disable ''run-to-main''), I'd imagine IAR could do the same. The trick to debugging this will be to step though the code until you observe the point of failure.

Cloning and modifying the template project is recommended until you can unravel all of the meta-data buried in the options, include paths, defines, etc.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..