Arduino Duemilanove: quick start howto
Quick steps to flash a BeRTOS image on Arudino Duemilanove.
NOTE: This howto has been tested on Ubuntu 10.04 (Lucid).
Download the required packages
Get the BeRTOS source code, available at the download section. In this howto we'll use the latest weekly snapshot.
$ wget http://download.bertos.org/snapshot/bertos-current.tar.bz2
Untar the BeRTOS source:
$ tar xvjf bertos-current.tar.bz2
Start the BeRTOS wizard and create a full project in 10 clicks
Run the following command to start the wizard:
$ ./wizard/bertos.py
Choose a name for your project (in this example we use arduino):
Confirm the BeRTOS version to use the BeRTOS version that you have just downloaded:
The project will use a predefined board, not a custom hardware, so we can confirm "Predefined board" for our project type:
Choose Arduino Duemilanove:
Let's start with a banchmark project: BeRTOS context switch.
Choose the "Base" setup:
Select the project output (check Create CodeLite? project if you want to manage this project using the CodeLite) IDE:
Confirm the setting summary:
The project is finished and ready to be deployed on Arduino!
Build the project
Move on your project directory and build everything:
$ cd ~/arduino $ make Building revision 1 arduino: Compiling bertos/benchmark/context_switch.c (C) arduino: Compiling bertos/kern/signal.c (C) arduino: Compiling bertos/kern/kfile.c (C) arduino: Compiling bertos/struct/heap.c (C) arduino: Compiling bertos/mware/formatwr.c (C) arduino: Compiling bertos/mware/event.c (C) arduino: Compiling bertos/drv/timer.c (C) arduino: Compiling bertos/cpu/avr/drv/timer_avr.c (C) arduino: Compiling bertos/kern/proc.c (C) arduino: Compiling bertos/cpu/avr/drv/ser_avr.c (C) arduino: Compiling bertos/drv/ser.c (C) arduino: Compiling bertos/mware/hex.c (C) arduino: Compiling arduino/main.c (C) arduino: Compiling bertos/mware/formatwr.c (PROGMEM) arduino: Assembling with CPP bertos/cpu/avr/hw/switch_ctx_avr.S arduino: Linking images/arduino.elf "/opt/avr-4.3.2/bin/avr-"objcopy"" -O srec images/arduino.elf images/arduino.s19 "/opt/avr-4.3.2/bin/avr-"objcopy"" -O ihex images/arduino.elf images/arduino.hex "/opt/avr-4.3.2/bin/avr-"objcopy"" -O binary images/arduino.elf images/arduino.bin
The BeRTOS image will be placed under the "images/" directory. The output is available in different formats: Motorola S19 record, binary, hexadecimal dump.
Flash the BeRTOS image on Arduino
Flash the image using avrdude (the avrdude package is available in the standard Ubuntu's repository):
$ avrdude -p m328p -c arduino -P /dev/ttyUSB0 -b 57600 -F -U flash:w:images/arduino.hex
The benchmark is running!
Get the output of the BeRTOS Context Switch benchmark from the UART:
$ setserial /dev/ttyUSB0 baud_base 115200 $ dd if=/dev/ttyUSB0 bs=1 Switch: 20.544 usec Switch: 20.544 usec Switch: 20.544 usec Switch: 20.544 usec Switch: 20.544 usec ...
Now we can see that with BeRTOS the context switch between two processes requires about 20 µs on the Arduino Duemilanove board.
Attachments
-
1-wizard.png
(45.0 KB) -
added by arighi 2 years ago.
wizard welcome screen
-
2-new-project.png
(21.2 KB) -
added by arighi 2 years ago.
wizard: new project
-
3-bertos-version.png
(22.3 KB) -
added by arighi 2 years ago.
wizard: choose the BeRTOS version
-
4-predefined-board.png
(17.4 KB) -
added by arighi 2 years ago.
wizard: predefined board / custom board
-
5-arduino.png
(90.6 KB) -
added by arighi 2 years ago.
wizard: arduino
-
6-context-switch.png
(23.2 KB) -
added by arighi 2 years ago.
wizard: context switch benchmark
-
7-base-setup.png
(17.8 KB) -
added by arighi 2 years ago.
wizard: base setup / advanced setup
-
8-project-output.png
(21.2 KB) -
added by arighi 2 years ago.
wizard: project output
-
9-setttings-summary.png
(37.7 KB) -
added by arighi 2 years ago.
wizard: settings summary
-
10-project-created.png
(27.0 KB) -
added by arighi 2 years ago.
wizard: project created
![(please configure the [header_logo] section in trac.ini)](/chrome/site/bertos_logo.png)









