AVRDUDE for ARM?

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Obviously AVRdude is designed for AVR CPUs. But it is small and lightweight to implement on the target side, and used by Arduinos.

 

I'm looking for a *really simple* Open Source bootloader to use with ARM. The host code needs to be multi-platform, with a CLI for makefiles. It needs to communicate over serial or USB-serial, and provide the ease of use that users have come to expect from Arduino upload.

 

I found OpenBLT, but it is already overly complicated. Should I just take the source for Optiboot and rework for ARM targets?

Bob.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

donotdespisethesnake wrote:
The host code needs to be multi-platform, ...
SAM Arduino are using BOSSA via USB DFU (IIRC); SAM-BA (Atmel's bootloader, 2 platform loader) also has a UART interface.

https://www.arduino.cc/en/Main/ArduinoBoardZero

...

Unlike other Arduino & Genuino boards which use avrdude for uploading, the Zero relies on bossac while the programming port uses openOCD .

...

Atmel SAM-BA In-system Programmer

http://www.atmel.com/tools/atmelsam-bain-systemprogrammer.aspx 

Atmel SAM-BA® software provides an open set of tools for programming the Atmel SAMA5, SAM3, SAM4, SAM7 and SAM9 ARM® core-based microcontrollers.

...

SAM-BA 3.1.4 for Windows (XP, Vista, Win7, Win8)

...

SAM-BA 3.1.4 Package for Linux 32-bits

...

SAM-BA 3.1.4 Package for Linux 64-bits

...

mbed may have a bootloader (I did not look for it)

https://www.mbed.com/en/


http://platformio.org/platforms/atmelsam

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

By "ARM" do you mean Atmel SAM or just "everyone's Cortex"? If SAM do you just mean M0/3/4 or are you including SAM7 and SAM9 too?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, ARM generally but basically that means support for 32 bit addressing I guess.

 

I looked at avrdude, it does a lot more stuff than I realised :) I found something even more simple and lightweight, http://markdingst.blogspot.co.uk... The protocol is derived from STM32, there are several stm32flash tools around. A simple python script can be used on the host side, and the target side is also very simple.

 

I've quickly knocked up some prototype code, looking quite easy.

Bob.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you want an ARMdude?

I use openocd on my linux box with a cheap ST-link V2 clone from ali.

Quick check shows precompiled binaries for windoze:

http://openocd.org/

 

My original configuration came from pandafruits, who has an excellent tutorial on getting started with ST32.

I had not looked at my binky led project for some time but it needs some cleanup.

# Programming target in makefile
flash: main.elf
	./write_bin.sh openocd.cfg main.elf

So what's this ./write_bin.sh?

#!/bin/bash
 
################################################################### 
# stm32 minimal example write_bin.sh
# openocd commands to program the micro, invoked in the Makefile
###################################################################
OPENOCD_CFG=$1
BIN_IMAGE=$2


# 2015-12-09 Add this command after "reset halt" to unlock flash sector 0.
# -c "stm32f1x unlock 0" 

killall -s 9 openocd
openocd -f ${OPENOCD_CFG} -c init -c "reset halt"  -c "flash write_image erase ${BIN_IMAGE}" -c "verify_image ${BIN_IMAGE}" -c reset -c shutdown

And for completeness: openocd.cfg

##############################################
# stm32 minimal example openocd.cfg
# config file for J-link used with stm32f1x
##############################################

source [find interface/stlink-v2.cfg]
source [find target/stm32f1x.cfg]

 

 

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah, I've realised AVRdude probably wasn't what I was looking for, I'd forgotten it handles hardware programmers. I was thinking of the serial download part, as used in Arduino.

 

The background here is that I want an Open Source serial bootloader that works like the Arduino one, but for ARM boards, e.g. Re-ARM, which weren't necessarily designed to be "Arduino friendly". The Due uses the native SAM-BA bootloader, which is specific to Atmel, and the Zero use an extra debug chip which is also some proprietary stuff.

 

The idea is that for the typical "Arduino" user, they don't need to buy a JTAG dongle, but they might buy a USB-serial adapter. All boards have a serial interface, but not all have a JTAG/SWD connector. The user also doesn't want to install special software, apart from the Arduino IDE. For the developer, I want a secondary bootloader on the target which is small, simple and easily portable. It really just needs to handle erase and write to flash.

 

On the host side, I need something that can run from the command line on Windows, Linux and MACOS, which doesn't need special drivers (absolute pain in Windows), and preferably doesn't need constant maintenance everytime a new CPU comes along and grows into a big bloated mess full of machine specific code.

 

Anyway I think this fits the bill as a base https://github.com/MarkDing/sim3.... It needs some rework to be more portable, but could hardly be simpler.

Bob.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But to have such a universal bootloader wouldn't all the chips need to have the same self writing flash mechanism? Anyway quite a few Cortex (unlike AVR) already come with a manufacturer designed bootloader mechanism anyway. Atmel SAM have SAM-BA in a lot of devices for example.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some time Ago I started with st32F103C8T6 and that chip has 2 jumpers to select different built-in bootloaders.

I didn't bother reading up on them, just plugged in a USD3 ST-Link V3 from Ali.

Works like a charm and comes with support for GDB. (But I only sniffed on debugging support).

 

Lots of ST boards come with Built-in ST-link anyway. And they usually have mouse bites so you can easily break it of and use it for other projects / board.

 

In the past I've used a logic analyser to catch debug info from any available peripheral.

Works beautiully to trace through a running program with very minimum impact on timing.

 

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
But to have such a universal bootloader wouldn't all the chips need to have the same self writing flash mechanism?

 

Sure, but so far I haven't come across a chip which doesn't have self-programming. I haven't checked, but I would go out on a limb and say that all Cortex chips in M0-M7 range have self-programming. Provided they have a Flash module, code can run from RAM.

 

Most Cortex chips I've looked at have one or more ROM bootloaders. Of those NXP LPCxx are probably best equipped, follow by STM32. NXP Kinetis (formerly Freescale) have only recently started to get a ROM bootloader. The problem is that they all have different proprietary protocols, invocation methods, sometimes the tools are Windows only. Having a single host tool helps support maintenance a lot.

 

I have got some code working on LPC1769, I'll probably also do Kinetis and STM32F4. I've created a repo at https://github.com/bobc/bootem

Bob.