5
\$\begingroup\$

Until now I used Microchip PIC, to program this microprocessor there is MPLAB. I would like to make a step forward and learn about other microcontrollers.

I found the BeagleBone Black quiet promising for my DIY project because there is a 2GB flash and 1GHz clock. I have a few question as a beginner: On the eewiki I found a tutorial where they are describing how to start, but this tutorial is based on SD card. If I want to use only the 2GB flash card than how can I load my software on it without using SD card?

I saw on that page that there is a bootloader(UBoot), what is this for? For example I just wan to blink a led, using PIC it is a few line of code which I upload and that's all, If I would like to do the same with a BeagleBone Black what I suppose to do? Do I need UBoot? How can I write this piece of code to the eMMC of the BeagleBone?

If I have a board without any preloaded software(including bootloader) how can I start to upload a software?

\$\endgroup\$
  • \$\begingroup\$ When using BeagleBone Black, you do not load a program directly into it, instead, you have an operating system running in it, such as linux, and you work with it in the high level, just like you use your computer. \$\endgroup\$ – abdullah kahraman Jun 1 '13 at 17:21
  • \$\begingroup\$ This is not true, there are examples for Raspberry PI. Have a look on the following repository github.com/dwelch67/raspberrypi \$\endgroup\$ – OHLÁLÁ Jun 1 '13 at 17:52
  • \$\begingroup\$ Hmm, yes good luck with that :) \$\endgroup\$ – abdullah kahraman Jun 1 '13 at 18:40
7
\$\begingroup\$

The processor on the BeagleBone is not a microcontroller, but rather a microprocessor (the Sitara AM3359 from Texas Instruments), which doesn't have non-volatile memory on the processor itself, but rather tries to load programs (such as an OS) into RAM via a communications interface (UART, USB, Ethernet) or from an external memory (FLash or memory card). The initialization/booting process for this processor is described in detail starting at page 4667 of the technical reference manual.

It seems the latter (booting from a memory device) is the case for the BeagleBone, which means you can "program" the BeagleBoard by changing the content of the on-board Flash (eMMC) or by forcing it to boot from the microSD card. It's not very clear from their documentation how easy or hard it is to create your own memory images (for SD card or the eMMC). I suspect it's not trivial.

\$\endgroup\$
  • \$\begingroup\$ Link for "technical reference manual" no longer valid. \$\endgroup\$ – tcrosley Jun 4 '14 at 21:08
3
\$\begingroup\$

On its first run, the BeagleBone Black has no stage1, no stage2 (U-boot mainly works as a stage2, it just provide a stage1, the Secondary Program Loader, or SPL, but most of the work is done is the secondary program).

When it is shipped, it has a SPL, U-boot, and linux on its eMMC. How was it flashed ? Probably using USB : see 26.1.8.6 USB Boot Procedure. A processor may boot in various boot modes. On USB boot, you may load a software in the internal SRAM memory. Internal RAM is 64kB large (1kB is reserved). The SPL is loaded and run in internal RAM. While the SPL looks for U-boot in eMMC, the stage1 used in production probably receive an other program using USB (so it can execute linux without using eMMC or SD card, and then flash the eMMC with the final program). The stage1 may do anything you want, as long as it fits in 64kB (instructions + data).

So, if you want to make a LED blink, you may just write a stage1 that performs this, but be aware that it's an inefficient use of a cortex-A board.

I linked the USB boot procedure, but did not explain how you may use it on your BBB. In fact, you can't. The processor can, but the BBB does not allow to use this boot mode. It allows 2 boot modes: on-board eMMC and SD card. This does not really change what I previously said : instead of sending your stage1 on USB, you just have to write it on SD Card (as a file called MLO).

\$\endgroup\$
2
\$\begingroup\$

The easiest way to blink an LED will be to write a program and execute it in userspace in Linux. The GPIO should be exposed as files in the filesystem, which you can open and manipulate from a userspace program, e.g. a simple C program. You could develop this program on your PC then cross compile it and scp it over to the target and then run it.

Or alternatively you could try and write a program at the "bare metal" to do the toggling, i.e. write a replacement for U-BOOT. This would be a lot more work however as you'd have to initialize all the peripherals yourself, but it could be done.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.