Hi Pavel,
1) could you please point me to the stuff that is executed before the main is reached (startup code)?
That is basically the
CMSIS startup code, which sets up the PLLs and then calls __main() to initialise the C environment which in turns calls main(). So your clocks, stack and heap are setup for you when main is called to give you an environment for C.
2) If I understand it correctly, then running "empty" application (without using any mbed libraries) like int main(void) { for (;;) {} return 0; } means only my dummy loop is execuded and nothing else like "background mbed stuff" (e.g. on interrupts) is running. This would imply all the chip including all peripherals is "mine" and I can control them as I like. Is that right?
That is exactly right. As you initialise peripherals they get setup, but nothing is in use and there are no "background" or "bootloader" type tasks. Note that TIMER3 will get setup if you try to do anything that requires a us tick used by a number of library functions, such as wait(), Ticker, Timeout and friends. But in summary, the chip is "yours" :)
3) From other threads here I understood, the compiler output binary is "compatible" with the naked NXP MCU. Where could I find the bin format description? How exactly could I transfer mbed's bin to another system with LPC1768?
The .bin file is just a raw binary/machine code. i.e. the first byte gets copied to address 0 of the FLASH, second byte to byte 1 etc. The mbed loads this .bin directly in to MCU FLASH, so there is no magic. If you put this .bin in any other LPC1768, it'll run too. We intentionally made it work like this so you really are running bare metal. This means any valid LPC1768 binary made by any means can be dragged on to an mbed and it'll run. In the same way, an .bin generated by the mbed tools can be loaded on to any LPC1768 chip via whatever means and it'll run.
4) Is there any possibility to add other than main.cpp file to the project? I can't hardly imagine any serious project in one module.
Of course! Just right-click on your project and select "New File...", then add an .h or .cpp files you want. You can make folders too.
We'll be putting a new handbook live in the next week which will be much better for adding documentation, and be searchable too. I'll aim to make sure we cover details like this. We've already got a writeup of things like the memory model which i've been wanting to get up for a while.
Hope this answers your questions. Have Fun!
Simon
Hi guys,
1) could you please point me to the stuff that is executed before the main is reached (startup code)?
2) If I understand it correctly, then running "empty" application (without using any mbed libraries) like
int main(void)
{
for (;;) {}
return 0;
}
means only my dummy loop is execuded and nothing else like "background mbed stuff" (e.g. on interrupts) is running. This would imply all the chip including all peripherals is "mine" and I can control them as I like.
Is that right?
3) From other threads here I understood, the compiler output binary is "compatible" with the naked NXP MCU. Where could I find the bin format description? How exactly could I transfer mbed's bin to another system with LPC1768?
4) Is there any possibility to add other than main.cpp file to the project? I can't hardly imagine any serious project in one module.
Thanks for info.
Regards
mumla