Connect the ST-Link v2 to the J5 connector on the board and use:
sudo openocd -f interface/stlink-v2.cfg -f target/lpc4350.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x14000000"
Use a USB/Serial board connected to Slot 5 and a terminal like “minicom” set to 115200 8n1 to access the NuttX prompt.
Edit jlink.cfg to use SWD:
sudo vi /usr/local/share/openocd/scripts/interface/jlink.cfg
Add:
transport select swd
Then flash with:
sudo openocd -f interface/jlink.cfg -f target/lpc4350.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x14000000"
Or:
sudo openocd -f interface/jlink.cfg -f board/lpc4350_spifi_generic.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x14000000"
Install lpc21isp:
sudo apt-get install lpc21isp
Produce a .hex file:
make menuconfig
Select Intel HEX binary format, save, and exit. Then:
make
Flash the firmware:
lpc21isp nuttx.hex /dev/ttyUSB0 115200 12000
Change /dev/ttyUSB0 to match your device.
Install SEGGER’s Software & documentation pack from their website.
Start the debug server and GDB:
JLinkGDBServer -device LPC4330_M4 -endian little -if JTAG -speed 10000 -localhostonly
arm-none-eabi-gdb -ex "set target-charset ASCII" -ex "set print pretty on" -ex "target remote :2331" -ex "set mem inaccessible-by-default off" nuttx
Upload code with GDB:
Ctrl+C
load
monitor reset
continue
Follow the User Guide from NXP, particularly sections 3.2 and 3.3. Install LPCScrypt from their website.
Enter bootloader mode:
Flash firmware with LPCScrypt:
./scripts/boot_lpcscrypt
./bin/lpcscrypt program +c /path/to/nuttx/nuttx.bin BankA
./bin/lpcscrypt resetCore
Or:
sleep 1
./bin/lpcscrypt -d /dev/ttyACM0 program +c LPC4330_M4/Smoothie2.bin SPIFI
sleep 1
./bin/lpcscrypt -d /dev/ttyACM0 resetCore
After flashing nuttx.bin, connect a USB/Serial board to Slot 5 and use “minicom” at 115200 8n1. Press “RESET” and you should see:
NuttShell (NSH)
nsh>
Type “help” or “?” for commands.
Compile with:
cd ~/nuttxspace/nuttx/tools
./configure.sh bambino-200e/netnsh
cd ..
make
Flash nuttx.bin, connect to your router, and use telnet with the IP assigned to the board.
Compile with:
cd ~/nuttxspace/nuttx/tools
./configure.sh bambino-200e/usbnsh
cd ..
make
Flash nuttx.bin, connect USB0 to your PC, reset the board, and use “minicom” with /dev/ttyACM0 at 115200 8N1.
TODO