2017-01-05 12:40 AM
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-project2017-01-05 12:49 AM
Haven't tried, found this:
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.
2017-01-05 01:15 AM
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
2017-01-05 01:20 AM
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.