Sonny05
Posts: 22
Joined: Wed Jun 24, 2015 4:53 pm

Boot code from SD card (other possibilities)

Sat Jun 27, 2015 5:45 pm

Hi all,

I have one question. For boot code to raspberryPi I use these steps:

1, remove SD card from raspberryPI and turn off.
2, create new file with name "kernel.img".
3, insert SD card to PC.
4, copy file "kernel.img" to SD card
5 remove SD card from PC
6, insert SD card to raspberryPI and turn on.
7, repeat 1step

This procedure is slow and uncomfortable.

Have anyone experience with faster procedure?

Is one with possibility this converter USB to UART? http://shop.pimoroni.com/products/usb-t ... sole-cable

User avatar
DougieLawson
Posts: 39602
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Boot code from SD card (other possibilities)

Sat Jun 27, 2015 7:28 pm

Sonny05 wrote: Have anyone experience with faster procedure?
When I was playing with bare metal I'd build on a RPi running Raspbian and write the bootable SDCard using a USB SDCard reader. You can pull the power on the bare metal machine without risk to the SDCard until you start writing data on the card.

Unless you program your bare metal system to drive a serial interface it doesn't have any way to talk to the outside world. That's the fundamental difference between running an OS and running bare metal.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Boot code from SD card (other possibilities)

Sat Jun 27, 2015 7:38 pm

Although I haven't seen him 'round here in quite a while, way back when, someone named 'dwelch' posted a bunch of stuff about how to do this using the serial port.

You can probably find it on a search of the forum and/or find his website which has all the details.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

Sonny05
Posts: 22
Joined: Wed Jun 24, 2015 4:53 pm

Re: Boot code from SD card (other possibilities)

Sat Jun 27, 2015 8:07 pm

His website I found:https://github.com/dwelch67/raspberrypi

I wanted to know who has what experience and what I need to buy.

jspeccy
Posts: 19
Joined: Sun Nov 30, 2014 6:25 pm

Re: Boot code from SD card (other possibilities)

Sat Jun 27, 2015 8:42 pm

Sonny05 wrote:His website I found:https://github.com/dwelch67/raspberrypi

I wanted to know who has what experience and what I need to buy.
You need a USB<->serial-3V3 cable like this: Raspberry Pi Cable, TTL-232R-RPI and put the firmware files bootcode.bin, fixup.dat, start.elf and kernel.img from Welch's bootloader05 sample into the SD.

Then, you can transfer files from PC to PI using the good old XMODEM protocol up to 115200 bps. I use a slightly modified bootloader05 to preserve the r0-r2 registers and allow transfers up to 1 Mbps.

It's an easy task. :)

Sonny05
Posts: 22
Joined: Wed Jun 24, 2015 4:53 pm

Re: Boot code from SD card (other possibilities)

Sat Jun 27, 2015 8:56 pm

Thanks jspeccy,

and what program you use to transfer files from PC to RPI?

jspeccy
Posts: 19
Joined: Sun Nov 30, 2014 6:25 pm

Re: Boot code from SD card (other possibilities)

Sat Jun 27, 2015 8:59 pm

Sonny05 wrote:Thanks jspeccy,

and what program you use to transfer files from PC to RPI?
'sx' program from Fedora 22 'lrzsz' package.

Sonny05
Posts: 22
Joined: Wed Jun 24, 2015 4:53 pm

Re: Boot code from SD card (other possibilities)

Sat Jun 27, 2015 9:30 pm

Thanks again

tgritchie
Posts: 19
Joined: Fri Jun 01, 2012 4:07 pm
Location: United Kingdom

Re: Boot code from SD card (other possibilities)

Tue Jun 30, 2015 11:34 am

Hi - I, too, started out with dwelch67s serial bootloader code to avoid the tedium of swapping SD cards in and out but now use Jamie Iles' remote debug code which not only allows loading of images thru the serial port but also some (admittedly limited) debugging using GDB. Check it out here: https://github.com/jamieiles/rpi-gdb

Trevor

Return to “Bare metal, Assembly language”