How to flash "main.hex" using lpc21isp (skip sd card bootloader)

I wish to flash my compiled image of Smoothieware to my Smoothieboard, such that it does not use the SD bootloader to update the image. My goal is to not have an SD card on my Smoothieboard at all, and I plan to use the “default.config” file when compiling.

From my understanding, if I flash “main.hex” to the appropriate location, then it will run after the SD bootloader times out (or if I can skip flashing the SD bootloader all together then it will run immediately).

I have tried the following sequence of commands, which flashes successfully but yields no activity from my Smoothieboard:

  • lpc21isp -wipe ./bootloader/DFU-Bootloader.hex /dev/tty.usbserial 230400 12000
  • lpc21isp ./LPC1768/main.hex /dev/tty.usbserial 230400 12000

My guess is because the “main.hex” is not being flashed to the correct location? Not sure where to move from here, or if this is possible given Smoothieware’s architecture. I also do not see a way to set the start address using lpc21isp if I attempt to flash the “main.bin” file.

Thank you very much!!

Imported from wikidot

You can’t use lpc21isp to flash at a specific location.

What you need to do instead is edit the flash location in the .ld file in Smoothie’s files, to use the 0 address instead of the ( I think ) 0x4000 address, then flash it as you would flash the bootloader, and it will just work.

Thank you for the quick help, it is working now :slight_smile:

After digging around more I found inside “./Rakefile” a reference to “#{MBED_DIR}/LPC1768/GCC_ARM/LPC1768.ld”, however I believe that file is first being copied from it’s origin location “mbed/src/vendor/NXP/cmsis/LPC1768/GCC_ARM/LPC1768.ld”

I opened the above file, and I found a reference to “ORIGIN” being at 0x00000000 was commented out and replaced with “16k”. Changing it back to zero, recompiling, and upload “main.hex” with lpc21isp then allows Smoothieware to run on boot.

FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
/* FLASH (rx) : ORIGIN = 16K, LENGTH = (512K - 16K) */