Hi all. How time flies. It has been 4 weeks since my last post. During this month, I have finished the design and implement of bootblock, Rom structure and cbfstool for ARM. Following I will show my changes to you all.
Continue reading GSoC2011(Week 5): the layout of coreboot rom and cbfstool for ARM
Category: ARM
GSoC2011(Week 1): Analysis of U-boot ARM boot code
This is such a busy week. At the end of last week, I have just ordered my OpenRD-Ultimate box but sadly it will be delivered at the end of June. So if I just wait for that box, I will not be able to test my code. That’s terrible! After talking with my mentor, I decided first porting coreboot to RealView Versatile/PB926EJ-S board then to OpenRD-Ultimate. Since qemu can emulate PB926EJ-S, I can test my code on it quickly and freely. After this work, the basic layout, libs and headers for ARM are ready to use. So I can start to port coreboot to OpenRD-Ultimate then.
Continue reading GSoC2011(Week 1): Analysis of U-boot ARM boot code
GSoC2011 Project: Porting coreboot to ARM architecture
I am so excited that my idea on porting coreboot to ARM architecture has been accepted by GSoC project this year. First, let me introduce myself to you all. I am now a junior student at Hebei University of Technology, People’s Republic of China. My major is Computer Science and Technology. Although my courses are almost focus on high-level software development like database system and software engineering, I am a fan of low-level development. I taught myself IA32 and ARM architecture last year. And during this summer, we will porting coreboot to ARM and make it a new bootloader for ARM.
Those days, I am studying the building system of coreboot deeply, and I am trying to add cross-compile toolchain support to it. Developers has created such a great system and I want to make it greater. 🙂
Thanks for reading my project and any comment is welcome.
libopenstm32 – a Free Software firmware library for STM32 ARM Cortex-M3 microcontrollers
I guess it's time to finally announce libopenstm32, a Free Software firmware library for STM32 ARM Cortex-M3 microcontrollers me and a few other people have been working on in recent weeks. The library is licensed under the GNU GPL, version 3 or later (yes, that's an intentional decision after some discussions we had).
The code is available via git:
$ git clone git://libopenstm32.git.sourceforge.net/gitroot/libopenstm32/libopenstm32 $ cd libopenstm32 $ make
Building is done using a standard ARM gcc cross-compiler (arm-elf or arm-none-eabi for instance), see the summon-arm-toolchain script for the basic idea about how to build one.
The current status of the library is listed in the wiki. In short: some parts of GPIOs, UART, I2C, SPI, RCC, Timers and some other basic stuff works and has register definitions (and some convenience functions, but not too many, yet). We're working on adding support for more subsystems, any help with this is highly welcome of course! Luckily ARM stuff (and especially the STM32) has pretty good (and freely available) datasheets.
We have a few simple example programs, e.g. for the Olimex STM32-H103 eval board (see photo). JTAG flashing can be done using OpenOCD, for example.
Feel free to join the mailing lists and/or the #libopenstm32 IRC channel on Freenode.
The current list of projects where we plan to use this library is Open-BLDC (an Open Hardware / Free Software brushless motor controller project by Piotr Esden-Tempski), openmulticopter (an Open Hardware / Free Software quadrocopter/UAV project), openbiosprog (an Open Hardware / Free Software BIOS chip flash programmer I'm in the process of designing using gEDA/PCB), and probably a few more.
If you plan to work on any new (or existing) microcontroller hardware- or software-projects involving an STM32 microcontroller, please consider using libopenstm32 (it's the only Free Software library for this microcontroller family I know of) and help us make it better and more complete. Thanks!
A simple DLP-USB1232H based JTAG programmer with OpenOCD support
Here's a quick introduction to using a cheap FTDI FT2232H based module (left-hand side on the photo) as a JTAG programmer together with the OpenOCD JTAG software for ARM and MIPS devices. The module I am using for thіs purpose is a DLP Design DLP-USB1232H, which is available from various sources (Digikey, Mouser, Saelig, and probably others) for 20-30 bucks plus shipping, depending on where you live.
By properly connecting the correct pins of the DLP-USB1232H to the target JTAG
device (I used an Olimex STM32-H103 eval board for testing) you can easily abuse the DLP-USB1232H as JTAG programmer. As I chose the proper DLP-USB1232H GPIOs for the TRST and (S)RST pins, OpenOCD even worked out of the box, without having to change a single line of code.
The only thing that's required is to provide OpenOCD with an interface config file that uses the usbjtag "layout". I have already submitted that config file upstream, I guess it should be merged soonish.
The usage is then pretty simple:
$ openocd -f interface/dlp-usb1232h.cfg -f board/olimex_stm32_h103.cfg
And in another xterm:
$ telnet localhost 4444 > init > reset halt > flash write_image erase fancyblink.bin 0x08000000 > reset
This flashes the given fancyblink.bin image onto the STM32-H103 eval board via the DLP-USB1232H JTAG programmer, where fancyblink.bin is an example program from my libopenstm32 project (that aims to create a full-blown firmware library for ST STM32 microcontrollers, similar to what avr-libc does for AVRs). Contributions for libopenstm32 (license is GPLv3 or later) are highly welcome btw., hint hint...
$ git clone git://libopenstm32.git.sourceforge.net/gitroot/libopenstm32/libopenstm32
Full schematics, datasheets, and detailed instructions for the JTAG programmer are available from a small page I created in my Random Projects wiki, which is intended for the various smaller projects I'm working on that don't warrant getting their own domain, wiki, etc:
The Random Projects wiki is open-for-all btw, feel free to use it for any freeish, software or hardware projects of your own if you want.
Anyway, the DLP-USB1232H is a really nice device as it can also be used for many other purposes, such as USB-to-Serial or SPI BIOS chip programming, but more on that in another blog post...
Building an ARM cross-toolchain with binutils, gcc, newlib, and gdb from source
I've been planning to write about building custom ARM toolchains for a while (I used stuff from gnuarm.com in the past, but I switched to the lastest and greatest upstream versions at some point). Among other things, recent upstream versions now have ARM Cortex support.
First you will need a few base utilities and libs:
$ apt-get install flex bison libgmp3-dev libmpfr-dev autoconf texinfo build-essential
Then you can use my tiny build-arm-toolchain script, which will download, build, and install the whole toolchain:
$ cat build-arm-toolchain #!/bin/sh # Written by Uwe Hermann <uwe@hermann-uwe.de>, released as public domain. TARGET=arm-elf # Or: TARGET=arm-none-eabi PREFIX=/tmp/arm-cortex-toolchain # Install location of your final toolchain PARALLEL="-j 2" # Or: PARALLEL="" BINUTILS=binutils-2.19.1 GCC=gcc-4.3.3 NEWLIB=newlib-1.17.0 GDB=gdb-6.8 export PATH="$PATH:$PREFIX/bin" mkdir build wget -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2 tar xfvj $BINUTILS.tar.bz2 cd build ../$BINUTILS/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib \ --with-gnu-as --with-gnu-ld --disable-nls make $PARALLEL make install cd .. rm -rf build/* $BINUTILS $BINUTILS.tar.bz2 wget -c ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.bz2 tar xfvj $GCC.tar.bz2 cd build ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib \ --enable-languages="c" --with-newlib --without-headers --disable-shared --with-gnu-as --with-gnu-ld make $PARALLEL all-gcc make install-gcc cd .. rm -rf build/* $GCC.tar.bz2 wget -c ftp://sources.redhat.com/pub/newlib/$NEWLIB.tar.gz tar xfvz $NEWLIB.tar.gz cd build ../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib \ --with-gnu-as --with-gnu-ld --disable-nls make $PARALLEL make install cd .. rm -rf build/* $NEWLIB $NEWLIB.tar.gz # Yes, you need to build gcc again! cd build ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib \ --enable-languages="c,c++" --with-newlib --disable-shared --with-gnu-as --with-gnu-ld make $PARALLEL make install cd .. rm -rf build/* $GCC wget -c ftp://ftp.gnu.org/gnu/gdb/$GDB.tar.bz2 tar xfvj $GDB.tar.bz2 cd build ../$GDB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib make $PARALLEL make install cd .. rm -rf build $GDB $GDB.tar.bz2
The final toolchain is located in /tmp/arm-cortex-toolchain per default, and is ca. 170 MB in size. I explicitly created the build script in such a way that it minimizes the amount of disk space used during the build (ca. 1.2 GB or so, compared to more than 3 GB in the "naive" approach).
Using the "-j 2" option for make (see script) you can speed up the build quite a bit on multi-core machines (ca. 30 minutes vs. 60 minutes on an AMD X2 dual-core box). Also, you can change the script to build for other target variants if you want to (arm-elf or arm-none-eabi, for example).
Checkout the blog entry How to build arm gnu gcc toolchain for Mac OS X by Piotr Esden-Tempski for similar instructions for Mac OS X users.
Oh, and while I'm at it — does anybody have any idea why there are no pre-built toolchains for embedded (microcontroller) ARM targets in Debian? There are some toolchains for other microcontroller architectures (avr, m68hc1x, h8300, z80) but not too much other stuff. Is there some specific reason for the missing ARM toolchains (other than "nobody cared enough yet")?
I have heard about Emdebian, but from a quick look that seems to be more intended for toolchains with Linux/libc, not for microcontroller firmware (i.e. no MMU, no Linux, no libc etc.), but maybe I'm wrong?