[Open_electroporator] culture shock yardboard with ST Nucleo-F401RE howto

Nathan McCorkle nmz787 at gmail.com
Thu Jun 30 23:18:04 UTC 2016


Cool! Maybe my MCU will show up today or tomorrow. Can you post the
hex file that finally got flashed? That way I can try flashing it
directly, skipping any cross-compilation (just to try things out).
After that I can then go through the complete compilation process, and
determine then the minimum setup for flashing when a binary was ready
to go.

On Thu, Jun 30, 2016 at 4:11 PM, John Griessen <john at cibolo.com> wrote:
> Here is how to set up all the open source software used to develop
> micropython
> without an IDE.  The idea is keeping it simple once this is all installed,
> but
> installing has lots of steps that are sometimes globbed together in an IDE
> install.
>
>
> ========cross compiling
> micropython===GCC_ARM+micropython+python3+stlink+rshell==============
>
>
> ========cross compiling micropython===python3===rshell==============
> install python 3.x first,
> sudo pip3 install rshell
>
> ========cross compiling micropython=====stlink================
> rshell needs the open source stlink setup to use nucleo boards...
> https://github.com/texane/stlink
>
> clone the source to either your user home dir, or /usr/local/src
> get dependencies installed on your system:
>
> sudo apt-get install cmake
> sudo apt-get install libusb-1.0-0-dev
> sudo apt-get install libgtk-3-dev
>
> cd stlink
> sudo mkdir build
> cd build
> sudo cmake -DCMAKE_BUILD_TYPE=Debug ..
> sudo make
> # Setup udev to create USB ports.  Since we are using a nucleo board with
> ST-Link version 2-1,
> # choose from /usr/local/src/stlink/etc/udev/rules.d
> # the file 49-stlinkv2-1.rules
> sudo cp 49-stlinkv2-1.rules /etc/udev/rules.d
> # restart udev so the USB device will pop on and off as it is plugged in
> sudo udevadm control --reload-rules
> sudo udevadm trigger
>
> # Now copy the built executables to a reasonable place such as ~/bin
> # or /usr/local/bin
>
> sudo cp st-flash st-info stlink-gui stlink-gui-local st-term st-util
> /usr/local/bin
>
> # Now try plugging the nucleo-F401RE into a USB port of the devel machine,
> then if you get results
> # like below, your tools for flashing micropython are ready:
> john at ecolab3 [~]ll /dev/stl*
> lrwxrwxrwx 1 root root  3 Jun 29 09:38 /dev/stlinkv2-1_ -> sdb
> lrwxrwxrwx 1 root root 11 Jun 29 09:38 /dev/stlinkv2-1_0 -> bsg/5:0:0:0
> lrwxrwxrwx 1 root root  3 Jun 29 09:38 /dev/stlinkv2-1_2 -> sg2
> john at ecolab3 [~]which st-flash
> /usr/local/bin/st-flash
>
> ========cross compiling micropython===GCC ARM================
> GCC ARM embedded only builds from source on old old ubuntu.
> If you want gdb and pyocd, you need 32 python2.7 and it works best in a
> container or VM...yuk!
>
> So, skip the IDE crap and just install a precompiled release version in your
> home dir:
> wget  https://launchpad.net/gcc-arm-embedded/+download
> r /usr/local -- I like /usr/local/gcc-arm-embedded with a symlink to the
> current version as below:
> cd /usr/local
> wget
> https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q2-update/+download/gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2
>
> ========cross compiling micropython===GCC ARM================
> =================install gcc-arm-embedded====================
> sudo mkdir /usr/local/gcc-arm-embedded
> sudo ln -s /usr/local/gcc-arm-none-eabi-5_4-2016q2
> /usr/local/gcc-arm-embedded
> # This symlink can be changed when a new /gcc-arm-embedded toolchain is
> available and is untar'd here.
>
> cd
> john at ecolab3 [~]which arm-none-eabi-gcc
> /usr/local/gcc-arm-embedded/bin/arm-none-eabi-gcc
> #If you get a result like the above, you're ready to use the toolchain from
> any directory.
> =================install gcc-arm-embedded====================
>
> ========cross compiling micropython=====micropython==============
> cd
> # Install micropython in your home dir
> sudo git clone --recursive https://github.com/micropython/micropython.git
> cd micropython/
> sudo git submodule update --init
> sudo git fetch origin
> sudo git pull
> sudo git submodule sync
> sudo git submodule update
>
> git checkout -b release-1.8.1 v1.8.1
> #Now the local checkout of micropython is not on the bleeding edge, but
> version 1.8.1
>
> cd stmhal
> make BOARD=NUCLEO_F401RE
> .
> .  # Goes for a minute or so with a 2 core 2GHz machine with 3GB RAM...
> .
> CC usbdev/class/src/usbd_msc_bot.c
> CC usbdev/class/src/usbd_msc_scsi.c
> CC usbdev/class/src/usbd_msc_data.c
> CC build-NUCLEO_F401RE/pins_NUCLEO_F401RE.c
> LINK build-NUCLEO_F401RE/firmware.elf
>    text    data     bss     dec     hex filename
>  271764     264   44156  316184   4d318 build-NUCLEO_F401RE/firmware.elf
> Create build-NUCLEO_F401RE/firmware.dfu
> Create build-NUCLEO_F401RE/firmware.hex
> #If the last lines are like above with no errors, you're looking good.
>
> ========cross compiling micropython=====micropython==============
>
> ========cross compiling micropython=====flashing a Nucleo-F401RE with
> stlink==============
> st-util
> john at ecolab3 [stmhal]st-util
> 2016-06-30T17:14:48 INFO /usr/local/src/stlink/src/common.c: Loading device
> parameters....
> 2016-06-30T17:14:48 INFO /usr/local/src/stlink/src/common.c: Device
> connected is: F4 device (Dynamic Efficency), id 0x10016433
> 2016-06-30T17:14:48 INFO /usr/local/src/stlink/src/common.c: SRAM size:
> 0x18000 bytes (96 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 16384
> bytes
> 2016-06-30T17:14:48 INFO /usr/local/src/stlink/src/gdbserver/gdb-server.c:
> Chip ID is 00000433, Core ID is  2ba01477.
> <ctl> c to end st-util
>
> make BOARD=NUCLEO_F401RE deploy-stlink
> .
> .
> size: 32768
> size: 32624
> 2016-06-30T17:10:40 INFO /usr/local/src/stlink/src/common.c: Starting
> verification of write complete
> 2016-06-30T17:10:42 INFO /usr/local/src/stlink/src/common.c: Flash written
> and verified! jolly good!
> # If you don't get a result like above, check jumpers:
> # CN1 on;  CN12 on; JP1 off; JP5 towards U5V; JP6 on
> # If error unknown chip id! try pushing reset before/during  deploy-stlink
> command
> ========cross compiling micropython=====flashing a Nucleo-F401RE with
> stlink==============
>
> ========cross compiling
> micropython===GCC_ARM+micropython+python3+stlink+rshell=============
>
>
> _______________________________________________
> open_electroporator mailing list
> open_electroporator at cibolo.us
> https://cibolo.us/mailman/listinfo/open_electroporator



-- 
-Nathan



More information about the open_electroporator mailing list