Skip to content

Commit

Permalink
Added prog 5
Browse files Browse the repository at this point in the history
  • Loading branch information
fthk63 committed Jun 26, 2015
1 parent fdcbc94 commit 3bebea0
Show file tree
Hide file tree
Showing 7 changed files with 602 additions and 0 deletions.
Empty file.
24 changes: 24 additions & 0 deletions src/5-MLO-LedBlink-RTCInterrupt-RelocatedIntVec/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
3-MLO-LedBlink-RTCInterrupt
===========================
The next logical step to "2".
Instead of using a delay loop we use the real time clock (RTC) on board BBB
to generate a 1-second interrupt and write our own custom IRQ handler
which just toggles the usr0 led.

To build:
1) Make sure you have built the signgp utility first.
2) Edit build.sh script to reflect your toolchain path
2) ./build.sh mlo

To run:
This file has to be put onto an sd-card in raw format as described in the TI AM335x TRM - Sec 26.1.7.5.5
1) Get hold of a u-sdcard and card reader.
2) Delete all partitions on it and ensure there is only free space.
3) Let BBB boot into its default OS and insert the usd.
4) Copy the MLO to '/root' on BBB - 'scp MLO [email protected]:/root' (default password is blank)
4) login to BBB - 'ssh [email protected]' (default password is blank)
4) sudo dd if=/dev/zero of=/dev/sdX bs=512K count=1 --- clear out first 512k bytes of the disk with zeroes; [usually in BBB you can replace 'sdX' by 'mmcblk0']
5) sudo dd if=/root/MLO of=/dev/sdX count=1 seek=1 conv=notrunc bs=128k --- write the MLO at an offset of 128k
6) While holding the boot (S2) button remove power cable/USB cable and re-insert power while continuing to hold down S2.
7) You should see the usr0 led toggle every second.

24 changes: 24 additions & 0 deletions src/5-MLO-LedBlink-RTCInterrupt-RelocatedIntVec/README.txt~
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
1-MLO-usdBoot:
==============

This is a bare metal ARM assembly program to just turn on the USR0 blue led on the BBB.
The actual binary generated will be prefixed with a TOC and GP header using the 'signgp' utility.
This final binary is called MLO - Minimal loader.
The actual purpose of an MLO is to chain load the second stage bootloader which will futher boot the kernel.
But here we're just trying to boot the BBB using our MLO from the external u-sdcard.
The MLO here just acts as a container for bare metal assembly code.

To build:
1) Make sure you have built the signgp utility first.
2) Edit build.sh script to reflect your toolchain path
2) ./build.sh mlo

To run:
This file has to be put onto an sd-card in raw format as described in the TI AM335x TRM - Sec 26.1.7.5.5
1) Get hold of a u-sdcard and card reader.
2) Delete all partitions on it and ensure there is only free space.
3) sudo dd if=/dev/zero of=/dev/sdX bs=512K count=1 --- clear out first 512k bytes of the disk with zeroes
4) sudo dd if=MLO of=/dev/sdX count=1 seek=1 conv=notrunc bs=128k --- write the MLO at an offset of 128k
5) Let BBB boot into its default OS and insert the usd.
6) While holding the boot (S2) button remove power cable/USB cable and re-insert power while continuing to hold down S2.
7) You should see the USR0 led glow
9 changes: 9 additions & 0 deletions src/5-MLO-LedBlink-RTCInterrupt-RelocatedIntVec/build-alt.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
export TOOLCHAIN_PATH="/usr/arm-linux-gnueabi/bin"

${TOOLCHAIN_PATH}/as $1.s -o $1.o
${TOOLCHAIN_PATH}/objcopy $1.o $1.bin -O binary
${TOOLCHAIN_PATH}/objdump -SD $1.o

../../bin/signgp ./$1.bin
mv $1.bin.ift MLO
9 changes: 9 additions & 0 deletions src/5-MLO-LedBlink-RTCInterrupt-RelocatedIntVec/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
export PATH=$PATH:"/home/mutex/Projects/dhARMa/toolchain/gcc-arm-none-eabi-4_9-2015q1/bin"

arm-none-eabi-as $1.s -o $1.o
arm-none-eabi-objcopy $1.o $1.bin -O binary
arm-none-eabi-objdump -SD $1.o > $1.dmp

../../bin/signgp ./$1.bin
mv $1.bin.ift MLO
Loading

0 comments on commit 3bebea0

Please sign in to comment.