Getting started questions

24 Jul 2010

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

24 Jul 2010

Hi Pavel,

user avatar Pavel Faltynek wrote:
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.

user avatar Pavel Faltynek wrote:
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" :)

user avatar Pavel Faltynek wrote:
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.

user avatar Pavel Faltynek wrote:
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

25 Jul 2010

Simon,

great, thank you, helpful answers. Looking forward for the handbook.

Regards

Pavel

16 Aug 2010 . Edited: 16 Aug 2010

Simon,

I desperately need a mbed board schematics. Can't find any reference, could you please point me to any?

I have bought LPCXpresso base board, but have powering troubles, the USB is not enough, probably it feeds the xpresso with 3V3 only. I have about 2V on Vin - wouldn't expect anything than 0V (nothing but USB cable connected). Can I simply interconnect Vin with Vu to feed the xpresso with 5V from USB? Or should I connect external power to Vin (what is the range allowed - what regulator/DC-DC used)? How is it processed, it is connected to Vout through any regulator? Is it joined e.g. via diode to USB's Vbus?

Thanks

Regards Pavel

 

EDIT: Sorry, forget it, finally I have found it ;)

16 Aug 2010

Hi Pavel,

Glad you found it! For future reference incase people stumble on this thread, it is on the "mbed NXP LPC1768" page in the handbook, see:

Hope it tells you everything you need to know. Please shout if we can help further.

Simon

17 Aug 2010

Simon,

yes, the schematics is pretty brief, but these questions were answered.

I would like to ask another question (let me know you are bored with endless repeated beginner questions ;) I have noticed i can't select/copy text from the mbed library help. Not sure if this is system/browser "feature" or mbed ide problem (previously I couldn't reach the context menu, because of firefox setting (disallowed "right click overriding")).

- opening I2C component page

- trying to select the declaration in the example to just copy it - nothing is selected on mouse down/drag

 

Thanks for any info.

Regards

Pavel

 

BTW: is there any "Preview reply before post" option in this forum?

17 Aug 2010

Hi Pavel,

 

user avatar Pavel Faltynek wrote:
I have noticed i can't select/copy text from the mbed library help. Not sure if this is system/browser "feature" or mbed ide problem

Yes, this is a known issue. We've been working on the new documentation engine (which went live recently on published projects) so will be looking to fix this when we bring that inline with the compiler.

user avatar Pavel Faltynek wrote:
BTW: is there any "Preview reply before post" option in this forum?
We'll be moving to the forums and notebooks over to using the wiki markup soon, as this is way more powerful (and less annoying!) than TinyMCE. I'll make sure we note a feature request for a preview option; thanks for the feedback.

Simon

18 Aug 2010

Simon,

thanks for info. In the case you would like to further improve the compiler IDE, I would suggest and vote for additional feature. Let's call it "local file links".

Motivation:

I'm (locally) using powerful editor which allows me to produce program code pretty quickly. I can't say any bad word about the mbed's Compiler IDE editor, but it's simply basic.

Feature:

I would like to have an option to mark any file in a project as a "local file link". This would cause file dialog opening and determining local source file (I would edit locally with my editor I use for ages). Anytime I would e.g. press dedicated "reload" button placed closely to the link file name, the local file would be uploaded to the mbed's project. I could compile it/save to mbed/test/whatever.

 

What do you think?

Does it make sense to you?

Would you consider this as a reasonable feature?

 

Regards

Pavel