I’m testing the Smoothieboard V2 Mini
The JP10 (BOOT2) is in the position 0 (tied to ground) because I will program it using SWD instead using the LPCScript DFU/bootloader.
First we need to clone the repositories:
$ git clone https://github.com/Smoothieware/smoothie-nuttx $ git clone https://github.com/Smoothieware/smoothie-v2
Enter inside “smoothie-nuttx” and compile the nuttx for smoothie v2 mini alpha:
$ cd smoothie-nuttx $ cd nuttx $ cd tools $ ./configure.sh smoothiev2-mini-alpha/smoothiedev $ cd .. $ make export ... CC: lpc43_ostest.c CC: lpc43_autoleds.c CC: lpc43_timer.c AR: lpc43_boot.o lpc43_appinit.o lpc43_mmcsd.o lpc43_highpri.o lpc43_ostest.o lpc43_autoleds.o lpc43_timer.o make[2]: Leaving directory '/smoothie-nuttx/nuttx/configs/smoothiev2-mini-alpha/src' make[1]: Leaving directory '/smoothie-nuttx/nuttx/arch/arm/src'
Just confirm the the file “nuttx-export.zip” was created correctly:
$ ls -l nuttx-export.zip -rw-rw-r-- 1 alan alan 2932905 Set 3 20:00 nuttx-export.zip
We need to copy this file to smoothie-v2 directory to compile the final firmware:
$ cp nuttx-export.zip ../../smoothie-v2/Firmware/
Then go to there and decompress the nuttx-export:
$ cd ../../smoothie-v2/Firmware/ $ unzip nuttx-export.zip ... inflating: nuttx-export/include/machine/_types.h inflating: nuttx-export/include/machine/ieeefp.h inflating: nuttx-export/include/math.h
Case you are using a version of gcc crosscompiler different from 6.3.1:
$ arm-none-eabi-gcc -v ... Thread model: single gcc version 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437] (GNU Tools for ARM Embedded Processors 6-2017-q2-update)
Then you need to export the variable the “ARMVERSION” with your version, see the Rakefile for more info.
We can compile the Unit Tests just executing:
$ rake testing=1 ... Compiling /tmp/smoothie-v2/Firmware/TestUnits/TEST_timer1.cpp for Bambino Compiling /tmp/smoothie-v2/Firmware/TestUnits/main.cpp for Bambino Linking for Bambino text data bss dec hex filename 394553 1128 11800 407481 637b9 smoothiev2_Bambino/smoothiev2.elf
Finally enter inside “smoothiev2_Bambino” and flash the firmware.
I’m using a STLink-v2 clone (low cost: about U$ 2.00) with only three pins: SWDIO, SWCLK and GND connected to JTAG header of the board:
$ cd smoothiev2_Bambino $ sudo openocd -f interface/stlink-v2.cfg -f target/lpc4330.cfg -c init -c "reset halt" -c "flash write_image erase smoothiev2.bin 0x14000000" Open On-Chip Debugger 0.10.0+dev-00172-g7719e96 (2017-08-24-16:57) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : auto-selecting first available session transport "hla_swd". To override use 'transport select '. adapter speed: 500 kHz Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Info : Unable to match requested speed 500 kHz, using 480 kHz Info : Unable to match requested speed 500 kHz, using 480 kHz Info : clock speed 480 kHz Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.270400 Info : lpc4350.m4: hardware has 6 breakpoints, 4 watchpoints target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x10402c40 msp: 0x10087ff0 auto erase enabled Info : Found flash device 'win w25q64cv' (ID 0x001740ef) target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x10000154 msp: 0x10087ff0 target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x10000198 msp: 0x10087ff0 wrote 458752 bytes from file smoothiev2.bin in 12.150717s (36.870 KiB/s)
Connect the serial console and you will get:
Starting tests... There are 35 registered tests... PlannerQueue-basic PlannerQueue-iteration ConfigTest-get_sections ConfigTest-load_section ConfigTest-load_sub_sections Dispatcher-check_callbacks Dispatcher-Remove_second_G1_handler Dispatcher-one_off_dispatch GCodeTest-basic GCodeTest-subcode GCodeTest-copy GCodeTest-Multiple_commands_on_line_no_spaces GCodeTest-Modal_G1_and_comments GCodeTest-Line_numbers_and_checksums MemoryTest-stats MemoryTest-AHBn Module-single_module Module-single_module_destructed Module-multi_module SDCardTest-mount SDCardTest-directory SDCardTest-write_read SDCardTest-read_config_init SDCardTest-unmount SlowTicker-test_20_hz SlowTicker-test_10_hz StreamsTest-stringstream StreamsTest-cout StreamsTest-OutputStream_null StreamsTest-OutputStream_sstream StreamsTest-OutputStream_fdstream StreamsTest-OutputStream_prependok StreamsTest-OutputStream_long_line TimeTest-delta_ik TimerTest-test_20_hz /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_PlannerQueue.cpp:7:PlannerQueue-basic:PAS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_PlannerQueue.cpp:53:PlannerQueue-iteratiS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_config.cpp:15:ConfigTest-get_sections:PAS [(enable, false)] /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_config.cpp:31:ConfigTest-load_section:PAS elapsed time 20000 us /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_config.cpp:51:ConfigTest-load_sub_sectioS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_dispatch.cpp:51:Dispatcher-check_callbacS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_dispatch.cpp:78:Dispatcher-Remove_secondS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_dispatch.cpp:91:Dispatcher-one_off_dispaS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_gcode.cpp:7:GCodeTest-basic:PASS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_gcode.cpp:31:GCodeTest-subcode:PASS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_gcode.cpp:52:GCodeTest-copy:PASS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_gcode.cpp:80:GCodeTest-Multiple_commandsS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_gcode.cpp:100:GCodeTest-Modal_G1_and_comS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_gcode.cpp:118:GCodeTest-Line_numbers_andS total used free largest Mem: 191152 41840 149312 115232 /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_mem.cpp:7:MemoryTest-stats:PASS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_mem.cpp:16:MemoryTest-AHBn:PASS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_module.cpp:18:Module-single_module:PASS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_module.cpp:40:Module-single_module_destrS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_module.cpp:62:Module-multi_module:PASS /home/alan/nuttxspace/SmoothieProject/smoothie-v2/Firmware/TestUnits/TEST_sdcard.cpp:26:SDCardTest-mount:FAIL: Exp1 ----------------------- 20 Tests 1 Failures 0 Ignored FAIL Done
