U-boot load bare metal using serial on Banana Pi M1

Install kermit

apt-get instal ckermit

Prepare script

vi u-boot-serial-loader

Fill with (change the file, load address, and go entry point

#!/usr/bin/kermit

# Serial port setup. These settings will likely need to be
# changed to match the configuration of your workstation
# and the ARM board you're working with.
set line /dev/ttyS0
set speed 115200
set serial 8n1

# General C-Kermit settings. These probably don't need to change.
set flow-control none
set file type bin
set carrier-watch off
set prefixing all
set modem none

echo "Prepared to boot new kernel. Reset the board now."

# This is the string that my board outputs to allow the user to
# gain access to the U-Boot console. Change this to suit your
# setup.
input 60 "Hit any key to stop autoboot"
# If your board wants you to press a different key to get to
# U-Boot, edit this line.
output " "
input 5 "u-boot>"
# Here, 0x800000 is the memory address into which the kernel
# should be loaded.
lineout "loadb 0x44000000"
# This should be the absolute path to your kernel uImage file.
send /root/src/sunxi-tools/myos.bin
input 5 "u-boot>"
lineout "go 0x44000630"

# This command drops you into a console where you can interact
# with the kernel.
connect

Run u-boot-serial-loader
boot pi
wait
ctrl \ to get console control

ctrl \q (quit)
ctrl \h (help)

Sample of output

scanning usb for storage devices... 0 Storage Device(s) found
 Hit any key to stop autoboot: 0
 CACHE: Misaligned operation at range [44000000, 440009fc]
 ## Total Size = 0x000009fc = 2556 Bytes
 ## Start Addr = 0x44000000
 => Connecting to /dev/ttyS0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
 Type the escape character followed by C to get back,
 or followed by ? to see other options.
 ----------------------------------------------------
 go 0x44000630
 ## Starting application at 0x44000630 ...

Hello from Allwinner A20!
 Booted from MMC0, entering an infinite loop.

Run interactively

Once you’ve connected to the board, run the loadb command:

==> loadb

Now escape back to the kermit shell prompt (ctrl+\ followed by ctrl+c by default). Tell kermit to transmit the file you want by doing:

Linux Kermit> send /path/to/file/you/want/to/load
Text will appear giving you information about the progress of the upload.

After the upload has finished switch back to the U-Boot command line by issuing the following command:

Linux Kermit> connect

Baremetal development process

Change the code
Make
run u-boot-serial-loader
boot
GOTO Change the code

 

Find more on this subject on:

Banana Pi Allwinner A20 uart
https://blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:serial_port_loading_files