Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 3 months ago.
Initialization code before main()
Hello All,
I am curious is there any mbed initialization code (for MCU or anything else) realized just before code reaches main()? I saw such a HW configs in EWB for Renesas' RL78.
thanks for info on that.
best regards
3 Answers
10 years, 3 months ago.
There is quite a bit of code that gets called before main. It initializes RAM (RW and ZI), sets clocks, stdio if used and also a hook specifically for the platform init code that is not always used etc... Also, any global object that is in your program has a constructor that will also get called before main.
The entry point for a program is address 0 and from this file you can see what all is called by looking here (may also have to do some digging)
10 years, 3 months ago.
I don't know for sure but I suspect so. If you dig into the mbed library there are platform specific files with the name startup_[CPU].s written in assembly. e.g. http://mbed.org/users/mbed_official/code/mbed-src/file/402bcc0c870b/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_MICRO/startup_LPC17xx.s
10 years, 3 months ago.
I don't believe so, The compiler is quite good at making tight code, although it does add MBED stuff & printf stuff.
I know, if for example, you define SPI-LCD (......); those pins get setup as SPI, DigitalIn, AnalogIn etc, the same as when you declare DigitalIn, AnalogIn etc, normaly.
Ceri