[SOLVED]Firmware compile error

Hi,
I try to compile firmware from git repo on ubuntu 12.04. for common-lib and communication lib no issue
but when try to compile core-firmware i got this error

…/src/spark_wiring_interrupts.cpp:59:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:60:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:61:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:62:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:63:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:64:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:65:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:66:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:67:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:68:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:69:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:70:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:71:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:72:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:73:7: error: expected primary-expression before ‘.’ token
…/src/spark_wiring_interrupts.cpp:74:7: error: expected primary-expression before ‘.’ token
make: *** [obj/src/spark_wiring_interrupts.o] Error 1

any hint ?

Hi @lemouchon,

It looks like your version of gcc is using C99, and not supporting gcc styling for field designators, here’s the code in question:

//Array to hold user ISR function pointers
static exti_channel exti_channels[] = {
  { .handler = NULL },  // EXTI0
  { .handler = NULL },  // EXTI1
  { .handler = NULL },  // EXTI2
  ... (etc)

I think (someone please correct / check me), you can simply change the code to look like this, since that struct only has one field:

static exti_channel exti_channels[] = {
  { NULL },  // EXTI0
  { NULL },  // EXTI1
  { NULL },  // EXTI2
  ... (etc, repeat for all)

Can you give that a try and try building? I’ll double-check with our firmware team to make sure this is okay.

Thanks!
David

indeed, removing the .handler = seem to let the code compile, i still need to check if the firmware is running properly.
thanks for the hint.

Just for information the gcc version used

arm-none-eabi-gcc (Linaro GCC 4.6-2011.10) 4.6.2 20111004 (prerelease)

Awesome, thanks! I filed a ticket for the firmware team for this as well.

Hi Dave,
Tryed to upload firmware

with dfu-util -d 1d50:607f -a 0 -s 0x08005000:leave -D core-firmware.bin
but get this

invalid dfuse address: 0x08005000:leave

root@macbook:/home/philippe/src/spark/core-firmware/build# dfu-util -l
dfu-util 0.5

© 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
© 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY

dfu-util does currently only support DFU version 1.0

Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/20001Ka,108001Kg"
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=1, name="@SPI Flash : SST25x/0x00000000/512*04Kg"
Found Runtime: [05ac:8213] devnum=0, cfg=1, intf=3, alt=0, name="UNDEFINED"
root@macbook:/home/philippe/src/spark/core-firmware/build#

Hi @lemouchon,

Looks like you’re using an old version of dfu-util (0.5), the current version is 0.7. The old version doesn’t understand the “:leave” part of the address. I think there is a command line flag for that version of dfu-util that accomplishes the same thing, but I don’t have it in front of me at the moment.

so if you do a:

dfu-util --help
dfu-util -d 1d50:607f -a 0 -s 0x08005000 -D core-firmware.bin -<reset / leave flag>

should be
dfu-util -d 1d50:607f -a 0 -s 0x08005000 -D core-firmware.bin --reset

and i got this, I am not sure if the firmware is well uploaded

C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
© 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY

dfu-util does currently only support DFU version 1.0

Filter on vendor = 0x1d50 product = 0x607f
Opening DFU USB device… ID 1d50:607f
Run-time device DFU version 011a
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/20001Ka,108001Kg"
Claiming USB DFU Interface…
Setting Alternate Setting #0
Determining device status: state = dfuDNLOAD-IDLE, status = 0
aborting previous incomplete transfer
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 1024
No valid DFU suffix signature
Warning: File has no DFU suffix
DfuSe interface name: "Internal Flash "
can’t detach
Resetting USB to switch back to runtime mode

Hey @lemouchon,

Make sure you’re using “sudo”, and you might need to make sure the firmware is an even number of bytes (dfu quirk). If possible you should really upgrade to the latest version of dfu-util as well.

size=67776 déc 17 16:43 core-firmware.bin
and i am doing it as root

will try to compile more recent version of dfu-util

sounds good @lemouchon, let us know if that does the trick!

Hi,
I compiled version 0.7 and all is working correctly.
Thanks for your support.

Philippe

2 Likes