Bare Metal on the pcDuino 3 Part 1

The pdDuino3 from Linksprite is an “Open Source” arm developer board. Open source here being used lightly. The linux system is open of course as per its license. So is its u-boot code. The end goal is to get the NuttX RTOS ported to the pcDuino3. The first step of course is to get the system booting without any form of an operating system. The first step is to get it booting in what is known as a bare metal system.

U-Boot

The first step in this system is to get u-boot working. This was quite simple. I followed the linux-sunxi directions and made a bootable SD card. The old or the mainline u-boot works just fine.

Bare metal code

Alright, so we have a working u-boot booting. A bunch of research finally led me to the olimex bare metal programming of the A13 tutorial page. But there’s a problem, I’m not using the A13! Luckily, the Allwinner chips use the same memory map. So the GPIO code at the end can be run without issue. I am using Fedora instead of Ubuntu. Here is my Makefile.

Working with peripherals

In the olimex article it mentions that GPIO only works when printf is used. Using compiler directives I was able to get this working without the need for printf being used. What this code does is walk LEDs down a line. You can check the pinout of the pcDuino for the correct pin bank and pin number.

Getting higher level peripherals working

So getting GPIOs working was pretty easy! In the next section I’ll discuss the woes on getting higher level peripherals running.

4 Comments


  1. Hello, this information i found useful, but i wondered if i could ask a question slightly related to this. I have yet to find the memory map for the A10, i will be using a dialect of basic and need to access the I/O ports from basic, is this difficult?

    Reply

    1. Hi John,

      There are a few places where you can find the memory map of the A10/A20.

      The chips user manual is a good place to find the register descriptions as well as the physical memory offsets needed.
      http://linux-sunxi.org/File:Allwinner_A10_User_manual_V1.5.pdf

      This wiki page has a good overview of the memory map, but many of the linked pages are lacking in information. I would recommend using this to find the general offset and the user manual for how to directly access the peripherals.
      http://linux-sunxi.org/Memory_map

      If you are using just GPIOs, you should be able to reference my code above. Otherwise the user manual should help.

      I hope this provides some of the information you’ve been trying to hunt down. I was in the same situation and that’s why I decided to write this page.

      Keep me posted on how your project goes and don’t be afraid to ask more questions!

      ~Ian

      Reply

      1. Thank you very much Ian for taking the time to help me, it’s very much appreciated. My programming experience is pretty limited and most was done using early Sinclair and BBC basic which i have a fairly good grasp of. The program i’m working on is to control a car gearbox and overdrive unit, so basically sensors in, logic and drive out. I am a little concerned with boot time and looking for ways to reduce this if possible

        Reply

  2. I’m glad I could help! This chip was seriously lacking any bare metal/DIY support so I wrote it to try to fill in some of the holes. Eventually I will get part 2 and 3 and maybe even a 4th done!

    Reply

Leave a Reply to John Lannigan Cancel reply

Your email address will not be published.