Programming smoothieboard LPC1768

Hi,
I’m currently working on a smoothieboard clone with LPC1768. It get DFU bootloader (GitHub - triffid/LPC17xx-DFU-Bootloader: DFU Bootloader for LPC17xx family) so program can be updated simply by putting firmware.bin on a sd card. I try with mbed studio & platformio to test blinky example with no luck. The update process don’t go till the end, the firmware.bin is renamed to firmware.cur but nothing happen. After that the board is not recognized by windows as a usb device. When i put back the smoothieboard firmware the flashing process go to the end and the board work fine.
What i’m missing when compiling blink example ? It’s possible to revert the original mbed firmware to the board (don’t found beginner tutorial on the net) ?
I come from arduino so i’m big newbie here. I will use the board in an analogue photobooth project.

Thanks
Flo

When working with a bootloader, you generally need to adjust the linker script to account for fact that bootloader uses space in flash memory. Looking at the linker script for the bootloader you linked, it looks like it uses the first 16k of flash. Assuming you use GCC, Mbed’s linker script for the LPC1768 is located here. This linker script or its settings would need to be modified to account for the address range used by the bootloader. For example, creating a custom target with:

"macros_add": ["MBED_APP_START=0x4000",  "MBED_APP_SIZE=0x7C000"],

will fix the location of the app in flash memory. However, other mods might be needed, because the linker script and startup code likely don’t assume the presence of a bootloader. For example, I expect this line will need to be deleted.

1 Like