cancel
Showing results for 
Search instead for 
Did you mean: 

IAR project

Cesar cfg
Associate II
Posted on January 05, 2017 at 09:40

Hello,

I want to create a project using IAR for an stm32 MCU.

Without using the IAR assembly startup file , i want to jump directly to the main function

Is there any solution to do this ?  

Thank you,

#iar-project
3 REPLIES 3
Seb
ST Employee
Posted on January 05, 2017 at 09:49

Haven't tried, found this:

0690X00000605wzQAA.png

Maybe this helps? Linker assign the reset vector content.. so it should come from either a linker file or a linker option.

Good luck !

PS: beware that all the global variables won't be initialized as 0x00 after reset, so get ready for strange behaviours if the code is not provisionned properly.

Cesar cfg
Associate II
Posted on January 05, 2017 at 10:15

thank you for your replay

without using the 'Automatic runtime library  selection' option  i want to use ' override default program entry'  option and change it from __iar_program_start to main in this case how can i initialise the vector table from the main file

Alan Chambers
Associate II
Posted on January 05, 2017 at 10:20

This is nothing to prevent you rewriting or modifying the assembly file to do nothing. It is just a source file in the IAR project. It is quite important, however, as it creates the interrupt vector table and default handlers, and sets the stack pointer and program counter. The C runtime needs to initialise static variables and so on before main() is called.

The reset handler comprises a call to SystemInit(), which performs system clock initialisation, followed by a called to __iar_program_start(), which sets the program counter and who knows what else, and then calls main(). Just modify this to call main() directly and see what happens... Or, more conservatively, remove the call to SystemInit(), or modify SystemInit().

Out of interest, I have created a prototype library in which I completely replaced all IAR and ARM components: startup assembler, linker script, SPL, even CMSIS, and so on, with my own. There is no code dependency on anything other than the hardware. Except the call to __iar_program_start(). I still have that. I'll be interested in how you get on with that.