User Tools

Site Tools


dev:nab:v2:nabgcc

# NabGCC

Overview

When Mindscape released the files related to the Nabaztag:tag, they released the source code of the firmware running on the Nabaztag:tag. When we tried to use them, we faced some problems:

  • The projet uses an old version of the proprietary IDE from IAR (v4.x)
  • It does not compile with the new version (v6.x)
  • The firmware is too big for the freeware version of IAR (old or new)
  • The source code is what I would call a big mess.
  • IAR is not well integrated with OpenOCD or GDB (or at least, it was not that easy to use).
  • IAR doesn't provide any .elf file to use with GDB, so debugging was nearly impossible.

So, I started a port of the code to be used with GCC. It's called NabGCC :)

Get the sources

It's currently hosted on my personnal GIT server:

git clone git://git.redox.ws/nabgcc.git

New architecture

├── inc        # Header files
│   ├── hal    #    Hardware abstraction (Motor, LED, i2c, ...)
│   ├── net    #    Wifi specific (IEEE802.11, hashes, ...)
│   ├── usb    #    USB Host and RT2501usb
│   ├── utils  #    Common tools
│   └── vm     #    Metal Virtual Machine
├── mtl        # Metal sources, for the BOOT bytecode
├── openocd    # OpenOCD config files
│   ├── interface
│   │   └── ftdi
│   └── target
├── src        # Source files
│   ├── hal    #    Hardware abstraction (Motor, LED, i2c, ...)
│   ├── net    #    Wifi specific (IEEE802.11, hashes, ...)
│   ├── usb    #    USB Host and RT2501usb
│   ├── utils  #    Common tools
│   └── vm     #    Metal Virtual Machine
├── sys        # System files (CPU and USB Host chip)
│   ├── asm    # ASM sources for IRQ handlers and CPU initialization
│   ├── inc    # Header files 
│   └── src    # Source files
└── testvm     # Test PC software folder, using stubs, to debug the VM
    ├── src -> ../src
    └── stubs  # Stubs replacing the µC specific parts
        ├── hal
        ├── usb
        └── utils

Compile

Using the makefile in the root folder, you can build the whole firmware project with just:

make 

Delete the objects files, and binaries with

make clean

The objects files should be in the obj/ folder, and the binaries in the bin/ folder.

Flash

Assuming you have OpenOCD running and connected to the target, flash a new firmware with

make program

Debug

You can load the firmware in GDB, and then debug your code:

arm-none-eabi-gdb ./bin/NabGCC.elf

Next commands are to be typed in GDB:

tar ext :3333
mon reset init

load
# And type 'r' to start using this code
# Stop with Ctrl + C
# and it's like normal debugging !

You can only set two breakpoints, which is quite limited… to delete all the breakpoints, just type 'd' and 'y'.

Happy hacking !

/home/share/www/redox.ws/wiki/data/pages/dev/nab/v2/nabgcc.txt · Last modified: 2023/11/24 22:23 by redox