loading
Here are my notes on how I setup my development environment for the DigiX board. The DigiX board (by digistump) is my new toy for this project. It has several handy features that augment the Arduino Due. Its based on the Due, claims to have compatible form factor, processor and features with the Due, can be programmed with the arduino 1.5.5 beta software.

For my project, it has a built in EEPROM (same chip family as my other instructable). A groovy wifi adapter thingy (which I want to use to configure settings in my project). There are a whole bunch of other features too which I hope to explore.

As I like to use vim for editing sketches and the arduino 1.5.5 software allows you to build from the command line without a gui. There are a few things I need to figure out about that setup with the digix board.

Step 1: Follow the Instructions... Mostly.

Here are the instructions. 

http://digistump.com/wiki/digix/tutorials/software

For Linux/ubuntu 64 bit.

My modifications were to unpack the tar in /usr/local

NB: Do everything that starts with a # char as root or via sudo.
NB: Do everything that starts with a $ char under your normal user account.

Install arduino beta 1.5.5:

# sudo -i

#  cd /usr/local
#  wget http://downloads.arduino.cc/arduino-1.5.5-linux64.tgz

get and install the digix addons:

#  wget https://sourceforge.net/projects/digistump/files/DigiXAddons-v08.zip/download
#  mv download DigiXAddons-v08.zip
#  mkdir foo
#  cd foo
#  unzip ../DigiXAddons-v08.zip
#  mv foo DigiX

Make some symlinks to keep things nice and separate:

#  cd arduino-1.5.5/
#  cd hardware/
#  ln -s ../../DigiX/hardware/digistump .

(there are a variety of ways to do this. Probably some are neater.)

Under a normal user account, start the arduino software

$ /usr/local/arduino-1.5.5/arduino

Open the blink example.
Select the Board from the tools menu: Digistump Digix (Standard)
Plug in the DigiX on its micro usb host (a device called /dev/ttyACM0 will turn up on the machine - which you probably wont notice unless you look in the system logs)
Make sure this device is selected in the port menu.

Click on the upload button (a right arrow). This should compile and upload the blink sketch.

A small light should start flashing near pin 13 on the DigiX board.

One thing I notice here is that the upload seems to be much quicker than the Due. I know that the sketch is kind of small however, the firmware upload speeds were a real problem on the Due where it took minutes to upload a large sketch.

The next thing to do is to modify the arduino code so that I can link against the arm libraries that I need.

 

Step 2: Add ARM Math Libraries to the Arduino Software.

The arduino software comes with a lot of nice (but fairly difficult to comprehend) DSP functions. These include discrete FFT functions like arm_rfft_q15(&S,out,outsq) that I like to use. But they are missed out from the linker. This step adds them to the arduino environment.

Presumably, this technique can be used to link against any C library.

If you want an example of some code that uses these functions then I suggest you google for "DueVGA Waterfall by stimmer". This is where I got the technique from and the code contains the original hints that I used with the Due.

Anyway, here are the changes I made to the arduino 1.5.5 installation, these will work for the Arduino Due, there are some suggestions about how to adapt that for the DigiX board.


1. Add a sym link to the libraries for the arduino_due_x/digix board variants:

This works for the Due (tested with 1.5.4):

# cd /usr/local/arduino-1.5.5/hardware/arduino/sam/variants/arduino_due_x/
# ln -s ../../system/CMSIS/CMSIS/Lib/GCC/libarm_cortexM3l_math.a .

But, if you have a DigiX (with 1.5.5), do this:

# cd /usr/local/arduino-1.5.5/hardware/digistump/sam/variants/digix/
# ln -s ../../system/CMSIS/CMSIS/Lib/GCC/libarm_cortexM3l_math.a .

2. Change the boards.txt file in two places adding -larm_cortexM3l_math to the build.extra_flags line:

For the Arduino Due:

# cd /usr/local/arduino-1.5.5/hardware/arduino/sam
# diff -u boards.txt.0 boards.txt
--- boards.txt.0 2014-02-15 12:56:00.498907451 +0000
+++ boards.txt 2014-02-15 12:57:41.803409801 +0000
@@ -13,7 +13,8 @@
arduino_due_x_dbg.build.usb_product="Arduino Due"
arduino_due_x_dbg.build.board=SAM_DUE
arduino_due_x_dbg.build.core=arduino
-arduino_due_x_dbg.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}
+# MDTE: arduino_due_x_dbg.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}
+arduino_due_x_dbg.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}  -larm_cortexM3l_math
arduino_due_x_dbg.build.ldscript=linker_scripts/gcc/flash.ld
arduino_due_x_dbg.build.variant=arduino_due_x
arduino_due_x_dbg.build.variant_system_lib=libsam_sam3x8e_gcc_rel.a
@@ -34,7 +35,8 @@
arduino_due_x.build.usb_product="Arduino Due"
arduino_due_x.build.board=SAM_DUE
arduino_due_x.build.core=arduino
-arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}
+# MDTE: arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}
+arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}  -larm_cortexM3l_math
arduino_due_x.build.ldscript=linker_scripts/gcc/flash.ld
arduino_due_x.build.variant=arduino_due_x
arduino_due_x.build.variant_system_lib=libsam_sam3x8e_gcc_rel.a

For the DigiX, make similar changes to the files under /usr/local/arduino-1.5.5/hardware/digistump/sam

3. Change the platforms.txt file:

For the Arduino Due (tested under 1.5.4):

In /usr/local/arduino-1.5.5/hardware/arduino/sam, Change platform.txt to add the following just after:

Add this: "{build.variant.path}/libarm_cortexM3l_math.a"
Just after "{build.variant.path}/{build.variant_system_lib}"
In the line after the comment that says "Combine gc-sections, archives, and objects"

Here is a diff of the changes:

# diff -u platform.txt.0 platform.txt
--- platform.txt.0 2014-02-15 12:58:59.011792641 +0000
+++ platform.txt 2014-02-15 13:00:18.792188245 +0000
@@ -55,7 +55,8 @@
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"

## Combine gc-sections, archives, and objects
-recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group
+# MDTE: recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group
+recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.variant.path}/libarm_cortexM3l_math.a" "{build.path}/{archive_file}" -Wl,--end-group

For the Digix, as in the above steps make similar changes to the platforms.txt file under:

/usr/local/arduino-1.5.5/hardware/digistump/sam/

Now your sketches should be able to include calls to anything in libarm_cortexM3l_math.a!

Yipee!


Command line compilation with arduino IDE 1.5+

This seems to work for the DigiX board:

/usr/local/arduino-1.5.5/arduino --board digistump:sam:digix --upload /root/Arduino/sketchbook/xblinky/xblinky.ino --verbose


 

About This Instructable

2,653views

5favorites

License:

Bio: http://www.reverbnation.com/bizarre
More by mdtevans:DigiX/Arduino DUE ARM math library software setup Arduino Due Guitar ADC Input and DAC Output Mixer Adding an 24LC256 EEPROM to the Arduino Due 
Add instructable to: