6 years, 11 months ago.

Does MBED flasher work for all "comptible" .bin files?

Hello,

I'm new to MBED, but I know something about supporting existing embedded projects at work.

I wanted to create very simple offline build environment I can use with arm-none-eabi-gcc to build for LPC1768. I installed arm-none-eabi-gcc from ppa to my ubuntu. I found sample program for blinking a LED : https://exploreembedded.com/wiki/Using_ARM_GCC_with_LPC_1768 . I adapted this program to MBED pinning. It operates on excessive amount of pins but I think this is ok. However, the blinking does not work. I copy the main.bin to /media/MBED , sync , reset MBED. But nothing happens. From the online compiler stuff works. My offline compiler also compiles stuff ok, but just running it on MBED possibly does not work.

So my question is: Does MBED flash work with generic bin files or does it need to be somehow laced with mbed library? You can take a look at my example project at: http://m.asuka.fi/uploads/LED_Blinking2.zip . Source code is included and also main.bin.

Regards, Janne

I made a stripped-down version of the MBED OS programming environment and LED example. I put it online in GitHub: https://github.com/usvi/mbed-LPC1768-simple Video of the example in action: https://www.youtube.com/watch?v=rBNpngUwVtM

posted by Janne Paalijarvi 03 May 2017

2 Answers

6 years, 11 months ago.

Hello Janne,
Yes, the flasher works but the program for LPC1768 shall start at address 0x00000000. And there is also allocated a vector table (0xC8 bytes) at the begin of IRAM0. After modifying the memory allocation section of the LPC17XX.ld linker scatter file as below and recompiling the project, all LEDs will blink on the mbed board as expected:

LPC17XX.ld

MEMORY
{
        /* LPC1768 : 512k ROM + 64k SRAM */
        /*------------------------------ */

	/* On-chip ROM is a readable (r), executable region (x) */
	/* On-chip SRAM is a readable (r), writable (w) and */
	/* executable region (x) */

	/* Main ROM region - 512k for LPC1768 */
	/* IROM (rx) : ORIGIN = 0x00002000, LENGTH = 512k */
	IROM (rx) : ORIGIN = 0x00000000, LENGTH = 512k

        /* local static RAM - 32k for LPC1756 */
        /* IRAM0 (rwx) : ORIGIN = 0x10000000, LENGTH = 32k */
        IRAM0 (rwx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8)

        /* AHB SRAM - 16k for LPC1756 - often used for USB */
        IRAM1 (rwx) : ORIGIN = 0x2007C000, LENGTH = 16k
		IRAM2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16k
}

Remember to reset the mbed after downloading the binary to the board.

Accepted Answer

Thank you for the information, it really teaches me much!

I however also bit the bullet and made a stripped-down version of the MBED OS programming environment and LED example. Only ARM-gcc and the listed sources are needed, no need to hassle around! I put it online in GitHub: https://github.com/usvi/mbed-LPC1768-simple Video of the example in action: https://www.youtube.com/watch?v=rBNpngUwVtM

I hope this helps new people to more easily get into pin-based MCU programming.

posted by Janne Paalijarvi 03 May 2017

That's producing really lightweight binary! Thank you Janne for sharing.

posted by Zoltan Hudak 04 May 2017
6 years, 11 months ago.

Janne,

The "goto" code for blinking an LED on all mbed hardware is:

Import programmbed_blinky

The example program for mbed pin-compatible platforms


You can view a list of the most popular code here: https://developer.mbed.org/code/

Thank you for posting this. I was however looking for settings for a Makefile-style project. I got things to work eventually, so this issue is resolved.

posted by Janne Paalijarvi 03 May 2017