Home |  Uploading |  Communicating |  Assembling | 


Uploading, Communicating and Re-Assembling Version 080

SourceForge.net Logo
 

Uploading Armpit Scheme to the MCU


The first step in getting Armpit Scheme to run on your board is to prepare an SD-card and copy the aps to it. This step is relatively independent of which board you want to run it on. So, in all cases, use a PC to format a blank SD-card such that its first partition starts at 1MB and is a FAT16 partition (not FAT32, not any other file system either). The maximum size of a FAT16 partition is 2GB and you can add other partitions on your card, after that first one, if you want, but Armpit Scheme won't use them. Make the SD-card bootable by setting the boot flag in it before leaving your formatting utility. Copy the appropriate aps file (from the Armpit Scheme bin/ folder) to the FAT16 partition of your SD-card (just as you would copy any file from one place to another, using a file browser, or the cp command). If you don't want to bother with finding which aps file your board needs (the suffix: 32, 64, T2 or T2co2 is in the 2nd column of the build_all script in the top-level code folder), you can copy the four of them to the card:


         apsT2co2.bin
         aps32.bin
         aps64.bin
         apsT2.bin

The next (and final) step is to place the LSD bootloader in MCU flash or on the SD-card. This step differs for each board. Seven of the boards need the bootloader to be written to internal memory and they are described first.

For the STM32F429 Discovery and STM32F746 Discovery, I use st-flash to copy the LSD to the MCU's flash:


         st-flash write bin/STM32F429_Disco_T2.bin     0x08000000
or:
         st-flash write bin/STM32F746G_Disco_T2co2.bin 0x08000000

After that, place the FAT16 SD-card in the board (using an SD-card breakout for the STM32F429 Discovery) and power-cycle the board.

For the LPC4330 Explorer, LPC4357 Explorer, I use dfu-util (version 0.6) to copy the LSD to SPIFI. To do this, first set the board's dip switches for DFU booting (via USB0 on the 4330 and USB1 on the 4357). Dip switch settings for the 4330, with ETH connector towards your left, are: down, up, down, up. For the 4357, dip switch settings, with ETH connector up, are: down, up, up, down. Plug the board to your computer (and/or power-cycle it if it was already plugged in). Run dfu-util:


         dfu-util -D bin/LPC4330Xplorer_T2.bin
or:
         dfu-util -D bin/LPC4357Xplorer_T2co2.bin

After that, put dip switches back into SPIFI boot position: down, down, down, up for both boards, place the FAT16 SD-card in the board, and power-cycle the board.

For the TM4C1294XL Launchpad, I use lm4flash to copy the LSD to the MCU's flash:


         lm4flash bin/EK_TM4C1294Co2_T2co2.bin

After that, place the FAT16 SD-card in the board and power-cycle it.

For the SAME70-Xplained and SAMV71-Xplained-Ultra, I use Microchip's (Atmel's) Sam-ba (version: sam-ba_2.16_cdc_linux) to copy the LSD to the MCU's flash (after setting appropriate jumper(s) and resetting the board):


         ./samba_load_M7 bin/SAME70_XPLD_T2.bin
or:
         ./samba_load_M7 bin/SAMV71_XPLD_T2.bin

Where samba_load_M7 is the shell script (you may need to change your interface from ttyACM0):


#!/bin/sh
#  send filename (upload) to MCU
  cp $1 samba_M7_temp.bin
  sam-ba_64 /dev/ttyACM0 at91samv71-xplained samba_M7.tcl
  rm samba_M7_temp.bin

and samba_M7.tcl is the TCL script:


# samba_M7.tcl: upload binary file in samba_M7_temp.bin to MCU
  send_file {Flash} "samba_M7_temp.bin" 0x00400000 0
  FLASH::ScriptGPNMV 2

After that, place jumper(s) back in normal boot position, place the FAT16 SD-card in the board, and power-cycle the board.

For the remainder of the boards, the LSD can be placed (copied, written) somewhere onto the FAT16 SD-card (rather than into some internal memory of the MCU). For 7 of these boards, the LSD is simply copied onto the FAT16 partition of the SD-card (eg. using a file browser) and then renamed (on the SD-card) as shown in Table 1. After this, eject the card from your PC, insert it in the board, set board jumper(s) or press button(s) (if any) as needed to boot from SD-card, and power cycle the board. (note: on the P1601, LSD is launched from the on-board u-Boot, that is stored in QSPI flash).

Table 1: LSD File Names in bin/ and on SD-card

BOARDLSD name in bin/LSD name on FAT16 SD-card
SAMA5D4-Xplained-UltraSAMA5D4_XPLD_32.binboot.bin
Beagle Board rev BBeagle_32.binMLO
Beagle Bone BlackBeagleBoneBlack_32.binMLO
Beagle XM rev CBeagle_XM_32.binMLO
Gumstix Overo TideOvero_Tide_32.binMLO
Gumstix Duovero CrystalDuoveroCrystal_32.binMLO
Parallela P1601 DesktopP1601_32.binuImage

For the remaining 6 boards, the LSD has to be written to specific sectors of the SD-card, in the space that precedes the FAT16 partition. The dd command, executed as super-user, is used to perform this copy (in Linux). The first step, with the SD-card in your PC, is to determine which device it is, and for the purpose of identifying the necessary approach for performing this task (if not yet familiar with it), I recommend that you search the web, before proceeding. It is important to clearly identify which device your SD-card is (where it is mounted) because the dd command is irreversible, and, if targeted at the wrong device (eg. your hard drive) may make your PC no-longer-bootable (among other things). The commands to use to copy the LSD to your SD-card are listed in Table 2, using either /dev/sdX or /dev/mmcblkX as (pseudo) device name (whether it is /dev/sdX or /dev/mmcblkX depends on card type and, possibly, Linux version). Be sure to substitute the correct name for where your SD-card is actually located, and execute the command for your board as root (eg. sudo).

Table 2: Linux dd command to copy LSD to SD-card

BOARDdd command
NXP MIMXRT1050-EVK dd if=bin/MIMXRT1050_EVK_T2.bin of=/dev/sdX conv=fsync bs=512 seek=2
NXP iMX8M-EVK dd if=bin/iMX8M_EVK_64.bin of=/dev/sdX conv=fsync bs=512 seek=66
FriendlyARM NanoPC-T3 dd if=bin/NanoPC_T3_64.bin of=/dev/sdX conv=fsync bs=512 seek=1
FriendlyARM NanoPC-T3+ dd if=bin/NanoPC_T3plus_64.bin of=/dev/mmcblkX conv=fsync bs=512 seek=1
Olimex A64-Olinuxino dd if=bin/A64_Olinuxino_64.bin of=/dev/mmcblkX conv=fsync bs=512 seek=16
HardKernel Odroid-C2 dd if=bin/Odroid_C2_64.bin of=/dev/sdX conv=fsync bs=512 seek=1

After that, execute the "sync" command a few times to make sure the write has completed, then eject the SD-card from the PC and place it in your board, configure the board's dip-switche(s), jumper(s) and/or press button(s) needed to boot from SD-card (if any), and power-cycle the board.


 

Communicating with Armpit Scheme


On most boards, one can communicate with Armpit Scheme using either the MCU's default uart (often the debug uart), or a USB device connector on the board. One exception is the A64-Olinuxino for which the USB Device has not yet been configured and thus one neds to use the uart (possibly with a uart to USB adapter cable). Also, the iMX8M-EVK has its default uart routed through an on-board uart-to-USB converted and so, although native USB is not configured for it within Armpit Scheme, one can still connect to this board via USB (a bit finicky w/r to power on & cable plug/unplug sequence, but okay; let LEDs dance & stabilize, start terminal program, and reset board). A third exception is the Odroid-C2 where USB-device works, but the default uart's pins stopped working (maybe via static discharge) and so uart communications have been rerouted to uart0/A with Tx on gpiox_12 and Rx on gpiox_13 (available on the on-board 2x20-pin connector).

On the PC side, one can run a terminal emulation program, such as Minicom, to interact with Armpit Scheme's REP. Communication parameters to use are 115200,8N1.


 

Re-Assembling Armpit Scheme


The source code of Armpit Scheme can be modified and re-assembled (if desired). Armpit Scheme is written in ARM assembly language, with unified syntax and macros to cover Thumb2, ARM (Aarch32) and Aarch64 instructions. It is assembled using the GNU assembler from binutils version 2.28 and development is performed on Fedora Linux. Running the shell script "build_all" in the top-level directory of the source code re-assembles all APS and LSDs. There are two boards for which the output of the GNU assembler needs post-processing: the A64-Olinuxino and the Parallela P1601. This post-processing is done automatically by the ANSI-C program "bin2loadable" located in either Allwinner/util or Xilinx/util ("build_all" runs it automagically). You may however need to recompile bin2loadable for your PC if the executables in the download do not match your system's characteristics (or you can comment the A64-Olinuxino and P1601 out of "build_all" if not interested in those boards). Running the shell script "utils_compile" recompiles the bin2loadable C programs (if needed).



Last updated July 12, 2018

bioe-hubert-at-sourceforge.net