tamago | https://github.com/f-secure-foundry/tamago
Copyright (c) F-Secure Corporation
https://foundry.f-secure.com
Andrea Barisani
andrea.barisani@f-secure.com | andrea@inversepath.com
Andrej Rosano
andrej.rosano@f-secure.com | andrej@inversepath.com
TamaGo is a framework that enables compilation and execution of unencumbered Go applications on bare metal ARM System-on-Chip (SoC) components.
The mx6ullevk package provides support for the MCIMX6ULL-EVK development board.
For more information about TamaGo see its repository and project wiki.
For the underlying driver support for this board see package imx6.
The package API documentation can be found on pkg.go.dev.
SoC | Board | SoC package | Board package |
---|---|---|---|
NXP i.MX6ULL | MCIMX6ULL-EVK | imx6 | mx6ullevk |
Go applications are simply required to import, the relevant board package to ensure that hardware initialization and runtime support takes place:
import (
_ "github.com/f-secure-foundry/tamago/board/nxp/mx6ullevk"
)
Build the TamaGo compiler (or use the latest binary release):
git clone https://github.com/f-secure-foundry/tamago-go -b latest
cd tamago-go/src && ./all.bash
cd ../bin && export TAMAGO=`pwd`/go
Go applications can be compiled as usual, using the compiler built in the
previous step, but with the addition of the following flags/variables and
ensuring that the required SoC and board packages are available in GOPATH
:
GO_EXTLINK_ENABLED=0 CGO_ENABLED=0 GOOS=tamago GOARM=7 GOARCH=arm \
${TAMAGO} build -ldflags "-T 0x80010000 -E _rt0_arm_tamago -R 0x1000"
An example application, targeting the MCIMX6ULL-EVK platform, is available.
The example application
provides reference usage and a Makefile target for automatic creation of an ELF
as well as imx
image for flashing.
Copy the built imx
image to a microSD as follows:
sudo dd if=<path to imx file> of=/dev/sdX bs=1M conv=fsync
IMPORTANT: /dev/sdX must be replaced with your microSD device (not eventual microSD partitions), ensure that you are specifying the correct one. Errors in target specification will result in disk corruption.
Ensure the SW601
boot switches on the processor board are set to microSD boot
mode:
switch | position |
---|---|
1 | OFF |
2 | OFF |
3 | ON |
4 | OFF |
Copy the built ELF binary on an external microSD card then launch it from the U-Boot console as follows:
ext2load mmc 1:1 0x90000000 example
bootelf -p 0x90000000
For non-interactive execution modify the U-Boot configuration accordingly.
The standard output can be accessed through the debug console found
on micro USB connector J1901 and the following picocom
configuration:
picocom -b 115200 -eb /dev/ttyUSB0 --imap lfcrlf
The application can be debugged with GDB over JTAG using openocd
and the
imx6ull.cfg
and gdbinit
debugging helpers published
here.
# start openocd daemon
openocd -f interface/ftdi/jtagkey.cfg -f imx6ull.cfg
# connect to the OpenOCD command line
telnet localhost 4444
# debug with GDB
arm-none-eabi-gdb -x gdbinit example
Hardware breakpoints can be set in the usual way:
hb ecdsa.Verify
continue
The target can be executed under emulation as follows:
qemu-system-arm \
-machine mcimx6ul-evk -cpu cortex-a7 -m 512M
\ -nographic -monitor none -serial null -serial stdio -net none
\ -kernel example -semihosting -d unimp
The emulated target can be debugged with GDB by adding the -S -s
flags to the
previous execution command, this will make qemu waiting for a GDB connection
that can be launched as follows:
arm-none-eabi-gdb -ex "target remote 127.0.0.1:1234" example
Breakpoints can be set in the usual way:
b ecdsa.Verify
continue
tamago | https://github.com/f-secure-foundry/tamago
Copyright (c) F-Secure Corporation
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation under version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See accompanying LICENSE file for full details.