[RK3288] 在 Firefly-RK3288 dev board 實作 bare-metal application: 閃爍 LED

Bare-metal application for Rockchip RK3288

This bare-metal application is used for Rockchip RK3288 SoC, and blink POWER/WORK LEDs on Firefly RK3288 develop board

Getting Started

Please prepare your environment and check your environment is correct, and follow flow down below

Get arm cross compiler

1
$ mkdir -p ${HOME}/opt
  • extract package
1
2
$ cd ${HOME}/opt
$ tar xjf ~/Downloads/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
  • change
1
$ chmod -R -w ${HOME}/opt/gcc-arm-none-eabi-7-2017-q4-major
  • test
1
$ "${HOME}"/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc --version
  • get binaries

All arm toolchain binaries are in

1
${HOME}/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/

Get U-boot

  • download u-boot
1
2
3
git clone git@192.168.1.178:RockChip/rk3288_uboot.git
git checkout bare-metal
./build_firefly.sh build
  • using dd flash to your SD card
1
sudo dd if=idbloader_SPL.img of=/dev/sdx seek=64

and /dev/sbx is your sd card partition

Build bare-metal application

  • modify Makefile
1
2
cd firefly-rk3288
vi Makefile
1
2
#In Makefile
CROSS_PREFIX= ${HOME}/toolchain/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-
  • build and copy binaries to your sd card (or usb disk)
1
2
3
make clean
make
cp kernel.elf kernel.bin /media/......

Running on U-boot

  • Boot , and go into command-line
  • SD card:
1
2
3
4
5
mmc dev 1
fatls mmc 1
fatload mmc 1 0x40000000 kernel.bin
dcache flush
go 0x40000000
  • USB
1
2
3
4
5
usb reset
fatls usb 0
fatload usb 0 0x40000000 kernel.bin
dcache flush
go 0x40000000

If you want to using “bootelf” command, just copy kernel.elf to RAM address “0x00800800”, 0x00800800 is bootelf start address

1
2
3
4
mmc dev 1 / usb reset
fatls mmc 1 / fatls usb 0
fatload usb/mmc 1/0 0x00800800 kernel.elf
bootelf