Home |  Uploading |  Communicating |  Assembling |  Notes | 


Uploading, Communicating and Re-Assembling + Special Notes
Documentation for Prior Versions
050 (2012) to 070 (2018)

SourceForge.net Logo
 

Uploading Armpit Scheme to the MCU


For microcontrollers of the LPC2000, LPC1700 and LPC1300 families (also LPC4357Xplorer_FLASH version), the Intel Hex image files (or the .bin files, since at least 060) from the Armpit Scheme download site can be uploaded to the MCU's FLASH memory via ISP (rs232 interface) using lpc21isp (1) or lpc21isp (2) (Linux or Windows -- as of June 7, 2007 those links appear inactive, try Yahoo lpc21isp, Augsburg lpc21isp, mikrocontroller lpc21isp or cmucam lpc21isp, alternatively lpcflash4linux or lpc2k_pgm), or the NXP (Philips) LPC2000 Flash ISP Utility (Windows). The binary image files (.bin) can be uploaded using lpc21isp with the -bin switch (lpc21isp Version 1.97 by Martin Maurer, from 2013, works well for me on Linux).

For microcontrollers of the LPC2800 family, the binary image file from the Armpit Scheme download site can be uploaded to the MCU's FLASH memory using dfu-util (linux) or NXP's MASS DFU program (Windows). In 070, the file to upload is the .bin.dfu produced by buildaps (see aps_bin directory), and in prior versions, it is the .ebn file produced from the binary (.bin) using Hostcrypt v2.0.

For microcontrollers of the LP4300 family, the binary image file from the Armpit Scheme download site can be uploaded to the MCU's SPIFI FLASH using dfu-util (linux). The file to upload is the .bin.dfu file from the aps_bin folder of version 070 or, for 060, produced from the binary (.bin) using this short C program.

For microcontrollers of the AT91-SAM3, SAM4, SAM7 and SAM9 family, the Binary image file from the Armpit Scheme download site can be uploaded to the MCU's FLASH memory (dataflash address 0 on SAM9) via ISP using AT91-ISP and SAM-BA (USB interface, Windows and now Linux, since 2012), Sam_I_Am (USB interface, Linux), SAM7_PGM (rs232 interface, Linux) or sam7utils (USB interface, multiple OSs).

For the SAMG53 (or ATSAMG53), use openocd-0.8.0.

For microcontrollers of the EP9300, LM3S1000, STM32, STR7 and STR9 families, the Binary image file from the Armpit Scheme download site can be uploaded to the MCU's FLASH memory using OpenOCD (Linux/Unix, Windows), and a JTAG wiggler.

For the STM32F4-Discovery and STM32F429-Discovery boards, the binary image file from the Armpit Scheme download site can be uploaded to the MCU's FLASH using the st-flash program from the st-link software (linux).

For the Samsung S3C2410 on the TinCan Tools Hammer, the Binary image file from the Armpit Scheme download site can be uploaded to the MCU's FLASH memory using TinCanTool's Flyswatter board and OpenOCD.

For the TI OMAP3530, DM3730, OMAP4430 and AM3359 on the BeagleBoard, BeagleBoard XM, BeagleBone Black, Overo Tide and Duovero Crystal, with ARMPit Scheme 070, the .bin.MLO file from the Armpit Scheme download site is a signed image while in 060 (also 050, 00.0250) the file has extension .ift (signed for loading into core RAM at 0x40200000, produced by signGP) -- either (both) is designed for booting from SD card (Live-SD). Copy the signed image file to a FAT16-formatted (2 GB max) SD card whose 1st partition has been set to active (see Beagle Board web site for instructions if needed) and rename the file MLO (the last letter is an upper-case o, not a zero). Insert the card in the device and power-up (press the user button on BeagleBoard to boot from SD). This version of ARMPit Scheme does not touch the on-board FLASH (if any).

IMPORTANT NOTE: in ArmPit Scheme 070, the Beagle Board XM and Duovero Crystal code are assembled to use SDHC cards in FAT16 format (that option excludes use of regular SD cards, of 2GB or less, which are getting harder to find at neighborhood stores). To produce such a card, start with a blank SDHC card (normally larger than 2GB), and partition it such that its first partition is smaller than 2GB (eg. using GParted in Linux) and format that parition to FAT16 (the rest of the card can be formatted to another file system format). Then (eg. using GParted) set the BOOT flag in the FAT16 partition (this puts value 128 at offset 446 in MBR, as needed for MLO booting). Then, copy the .bin.MLO file to MLO in the FAT16 partition.

For the TI OMAP3530 on the BeagleBoard, with ARMPit Scheme 00.0241, the Binary image file from the Armpit Scheme download site can be uploaded to the MCU's 64KB of internal RAM using the U-Boot command: loadb 40200000 (then use kermit to send the .bin file) after which the program is started with the U-Boot command: go 40200000. The program then runs from on-chip RAM while Pop RAM is used for the heap (96MB) and to shadow the NAND Flash (32MB shadowing the top 32MB of NAND, used to store scheme user files). It takes about 5 seconds to get to the Armpit prompt due to the copying of the scheme user file area from NAND Flash to shadow RAM. U-Boot can also be used to Flash the Armpit Scheme core to NAND and auto-start it on MCU reset (be careful not to erase X-Loader and U-Boot or the ability to re-flash the Armpit core, or Linux, or some other system, onto the board, will then depend on the availability of an appropriately formatted external SD/MMC boot medium).


 

Communicating with Armpit Scheme


Once Armpit Scheme is loaded onto the MCU you can communicate with its REP (Read-Eval-Print loop) using a terminal emulation program such as Minicom (Solaris, Linux, Mac OSX: fink install minicom) or HyperTerminal (Windows). As of version 070 communication parameters for on-board rs232 serial interfaces (including USB-to-rs232) are mostly 115200,8N1. On prior versions, it was mostly 9600,8N1, except for the BeabgleBoard that runs at its default of 115200 Bauds (as used also by U-Boot) and a few MCUs had been upgraded to 115200 or 57600 in version 060. For boards with USB (LPC-H2148, SAM7-H256, STR-H711 ...) the USB communication parameters are 115200,8N1 and the interface (USB CDC ACM) uses either the built-in driver in Linux and MacOSX, the usbsacm driver in Solaris 10 (built-in since 07/07) or the built-in usbser.sys driver in Windows (Search for it and copy it out of the .cab archive). In *NIX, look at /dev to find the new port that Minicom should use to connect with Armpit Scheme (eg. /dev/term/0 on Solaris, /dev/tty.usbmodem4B11 on Mac OSX, /dev/ttyUSB0 or /dev/ttyACM0 on Linux). On MS Windows, the OS applies a user-supplied file to attach device and driver -- you can use usbser.inf from the lpcusb project or adapt gserial.inf (cut it out from middle of page) by changing the Vendor ID in [GSerialDeviceList] to "USB\VID_FFFF&PID_0005", then, use Device Manager to find which COM port HyperTerminal should use to connect to the Armpit Scheme device.

Starting with version 00.0156, Armpit Scheme no longer sends linefeeds after carriage returns. The communication software (minicom, HyperTerminal) needs to be configured to add these line feeds for proper display.


 

Re-Assembling Armpit Scheme


The source code of Armpit Scheme (eg. armpit_00.0098.s) can be modified and re-assembled (if desired). Armpit Scheme is currently written in ARM assembly language, with unified syntax to cover ARM and Thumb2 instructions. It is assembled using the GNU assembler from binutils version 2.22 and development is performed on Fedora Linux. Some time ago it was written using ARM instructions only (ARM7TDMI) and assembled with the GNU assembler version 2.17. Development was performed on SUN Sparc under Solaris 10 (SunOS blade 5.11 snv_27 sun4u sparc SUNW) with the assembler from the GNU ARM Toolchain made available by CodeSourcery. You may use any appropriate develoment environment (Linux, MacOSX, Windows) to modify, reassemble and upload the code. On really old versions, the first few lines of source code are used to specify the target board. In version 00.0017, for example, you can just uncomment the line corresponding to your target (here: Tiny2106) and reassemble for that board:


     TINY_2106	= 1
     @TINY_2131 = 1
     @TINY_2138	= 1
     @H_2148	= 1
     @H_2214	= 1

In versions 00.0036 to 00.0098 you should uncomment the line corresponding to your MCU type as well as that corresponding to your board and specify whether the board as native USB (LPC-H2148, SAM7-H256, STR-H711). For example, for the LPC_H2148:

  @ 1- Select MCU Family:
     LPC_2000	= 1	@ uncommment if assembling for NXP   LPC2000  family MCU
     @AT91_SAM7	= 1	@ uncommment if assembling for ATMEL AT91SAM7 family MCU
     @STR_7xx 	= 1	@ uncommment if assembling for ST    STR7xx   family MCU
  @ 2 - Select Board:
     @TINY_2106	= 1	@ uncomment if assembling for NewMicros Tiny-2106 board (lpc2000)
     @TINY_2131	= 1	@ uncomment if assembling for NewMicros Tiny-2131 board (lpc2000)
     @TINY_2138	= 1	@ uncomment if assembling for NewMicros Tiny-2138 board (lpc2000)
     @SFE_Logomatic= 1	@ uncomment if assembling for SparkFun  Logomatic board (lpc2000)
     @LPC_H2103	= 1	@ uncomment if assembling for Olimex    LPC-H2103 board (lpc2000)
     LPC_H2148	= 1	@ uncomment if assembling for Olimex    LPC-H2148 board (lpc2000)
     @LPC_H2214	= 1	@ uncomment if assembling for Olimex    LPC-H2214 board (lpc2000)
     @SAM7_H256	= 1	@ uncomment if assembling for Olimex    SAM7-H256 board (at91sam7s)
     @STR_H711	= 1	@ uncomment if assembling for Olimex	STR-H711  board (str7xx)
  @ 3- Specify if board has USB:
     has_usb	= 1	@ uncomment if board has USB (comment out if board doesn't have USB)

The modified source code can then be re-assembled, linked (to start at 0x00000000) and converted to Intel Hexadecimal and binary formats using a sequence of commands such as (on the development machine):

     arm-none-eabi-as -mcpu=arm7tdmi -o a.o    armpit_00.0098.s
     arm-none-eabi-ld -Map map.txt --script build_link_98 -o a.elf a.o
     arm-none-eabi-objcopy -O ihex   a.elf armpit_00.0098.hex
     arm-none-eabi-objcopy -O binary a.elf armpit_00.0098.bin
where build_link_98 is the script file:

     SECTIONS
     {
       .text 0x0000 : 
         { *(.text) ; _endflash = . ; }
       .data   ram_address :
        AT ( ADDR (.text) + SIZEOF (.text) )
         { _startram = . ; *(.data) ; _endram = . ;  }
     }

In more recent versions (eg. 070) the process is slightly more involved but (hopefully) not exceedingly so.


 

Special Notes (rarely updated)


Note 1: The Tiny2131, LPC-H2103 and LPC-P1343 implementation of Armpit Scheme is a reduced version because of the small memory of the LPC2131, LPC2103 and LPC1343 MCUs.

Note 2: Using the USB plug (USB<->rs232) on the LPC-H2214 board requires that you first install the required driver for the on-board FTDI converter chip, onto the upload host.

Note 3: To compile lpc21isp (if needed) on Solaris 10, you may need to modify the C source code in lpc21isp.c, to replace the line:


     cfmakeraw(&IspEnvironment->newtio);

with the 5 lines:

     IspEnvironment->newtio.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
     IspEnvironment->newtio.c_oflag &= ~OPOST;
     IspEnvironment->newtio.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
     IspEnvironment->newtio.c_cflag &= ~(CSIZE|PARENB);
     IspEnvironment->newtio.c_cflag |= CS8;

Note 4: Program upload onto the LPC-H2148 Flash has to be performed via the MCU's rs232 interface (or JTAG if available) as its USB device is not attached to the ISP bootloader.

Note 5: To use lpc21isp with the LPC2478, the following line may need to be added to the LPCtypes[] (this depends on your version of lpc21isp):


     { 0x1701FF35, 2478, 512, 64, 27, 4096, SectorTable_213x }

It may also be necessary to comment out the following 2 lines in main() (right after OpenSerialPort) to avoid losing the immediate 'OK' response from the MCU:

    //   ResetTarget(&IspEnvironment, PROGRAM_MODE);
    //    ClearSerialPortBuffers(&IspEnvironment);



Last updated December 2, 2014

bioe-hubert-at-sourceforge.net