0

circuitpython-4.0.0-beta.7 compile error - struct.error: unp
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

circuitpython-4.0.0-beta.7 compile error - struct.error: unp

by KevinLee on Sun Apr 21, 2019 10:31 am

I downloaded the latest circuitpython source code from github: https://github.com/adafruit/circuitpyth ... a.7.tar.gz
Then I tried to make it and got the following error:
kevin@kevin-lee:~/opensource/circuitpython/git_cpy/circuitpython-4.0.0-beta.7/ports/atmel-samd$ make BOARD=metro_m4_express V=1 -j4
.....................................................
CC build-metro_m4_express/autogen_display_resources.c
LINK build-metro_m4_express/firmware.elf

499712 bytes free in flash out of 499712 bytes ( 488.0 kb ).
186368 bytes free in ram for stack out of 196608 bytes ( 192.0 kb ).

Create build-metro_m4_express/firmware.bin
Create build-metro_m4_express/firmware.uf2
Traceback (most recent call last):
File "../../tools/uf2/utils/uf2conv.py", line 292, in <module>
main()
File "../../tools/uf2/utils/uf2conv.py", line 260, in main
from_uf2 = is_uf2(inpbuf)
File "../../tools/uf2/utils/uf2conv.py", line 31, in is_uf2
w = struct.unpack("<II", buf[0:8])
struct.error: unpack requires a buffer of 8 bytes
Makefile:354: recipe for target 'build-metro_m4_express/firmware.uf2' failed
make: *** [build-metro_m4_express/firmware.uf2] Error 1

The compiling tool I used was gcc-arm-none-eabi-7-2018-2-update.
Generated firmware.elf.map was about 2.0MB, but firmware.elf was 812 bytes and firmware.bin was 0 byte.
What I should do to fix this issue?

Thanks in advance.

KevinLee
 
Posts: 4
Joined: Sun Apr 21, 2019 10:18 am

Re: circuitpython-4.0.0-beta.7 compile error - struct.error:

by jerryn on Sun Apr 21, 2019 5:47 pm

Take a look at this guide for how to build Circuitpython
https://learn.adafruit.com/building-circuitpython/introduction

Hopefully you are just missing some part of the necessary configuration.

jerryn
 
Posts: 919
Joined: Sat Sep 14, 2013 9:05 am

Re: circuitpython-4.0.0-beta.7 compile error - struct.error:

by KevinLee on Mon Apr 22, 2019 1:16 am

jerryn wrote:Take a look at this guide for how to build Circuitpython
https://learn.adafruit.com/building-circuitpython/introduction

Hopefully you are just missing some part of the necessary configuration.


Hi Jerry, thanks for your suggestion.

Yes, if I follow the instruction to download all source code and compile it, there was no errors.
But I tried to add a new driver to atmel-samd/asf4, I would get the error message.
There would be something I might be missing.

KevinLee
 
Posts: 4
Joined: Sun Apr 21, 2019 10:18 am

Re: circuitpython-4.0.0-beta.7 compile error - struct.error:

by danhalbert on Mon Apr 22, 2019 7:49 am

Could you say what you changed exactly, or fork the circuitpython repo and push your changes back to github?

danhalbert
 
Posts: 1684
Joined: Tue Aug 08, 2017 12:37 pm

Re: circuitpython-4.0.0-beta.7 compile error - struct.error:

by KevinLee on Mon Apr 22, 2019 12:12 pm

Hi ,
I uploaded modified source code to attachment. asf4_samd51_update.tar.xz
And I modified the Makefile file in ports/atmel-samd to avoid compiling errors.
Code: Select all | TOGGLE FULL SIZE
INC += -I. \
       -I../.. \
       -I../lib/mp-readline \
       -I../lib/timeutils \
       -Iasf4/$(CHIP_FAMILY) \
       -Iasf4_conf/$(CHIP_FAMILY) \
       -Iasf4/$(CHIP_FAMILY)/config \
       -Iasf4/$(CHIP_FAMILY)/hal/include \
       -Iasf4/$(CHIP_FAMILY)/hal/utils/include \
       -Iasf4/$(CHIP_FAMILY)/hri \
       -Iasf4/$(CHIP_FAMILY)/hpl/core \
       -Iasf4/$(CHIP_FAMILY)/hpl/gclk \
       -Iasf4/$(CHIP_FAMILY)/hpl/pm \
       -Iasf4/$(CHIP_FAMILY)/hpl/port \
       -Iasf4/$(CHIP_FAMILY)/hpl/rtc \
       -Iasf4/$(CHIP_FAMILY)/hpl/tc \
       -Iasf4/$(CHIP_FAMILY)/include \
       -Iasf4/$(CHIP_FAMILY)/CMSIS/Include \
       -Iboards/$(BOARD) \
       -Iboards/ \
       -Iperipherals/ \
       -Ifreetouch \
       -I../../lib/tinyusb/src \
       -I../../supervisor/shared/usb \
       -I$(BUILD)
Attachments
asf4_samd51_update.tar
add a TC driver to project and all project source codes are from start.atmel.com
(597.41 KiB) Downloaded 3 times

KevinLee
 
Posts: 4
Joined: Sun Apr 21, 2019 10:18 am

Re: circuitpython-4.0.0-beta.7 compile error - struct.error:

by danhalbert on Mon Apr 22, 2019 12:42 pm

Could I ask you why you're adding the TC driver? We already use the TC's in ports/atmel-samd/common-hal/pulseio and some other places. If you want to use TC's for some other purpose inside CircuitPython, you'll need to manage their use in a compatible way with our current use.

We don't use the asf4 drivers for TC's and TCC's in the interest of efficiency. We do use asf4 in other places, but are trying to gradually remove our usage of it to save space and compile time.

danhalbert
 
Posts: 1684
Joined: Tue Aug 08, 2017 12:37 pm

Re: circuitpython-4.0.0-beta.7 compile error - struct.error:

by KevinLee on Mon Apr 22, 2019 12:57 pm

danhalbert wrote:Could I ask you why you're adding the TC driver? We already use the TC's in ports/atmel-samd/common-hal/pulseio and some other places. If you want to use TC's for some other purpose inside CircuitPython, you'll need to manage their use in a compatible way with our current use.

We don't use the asf4 drivers for TC's and TCC's in the interest of efficiency. We do use asf4 in other places, but are trying to gradually remove our usage of it to save space and compile time.

Yes, I add the TC driver for other purpose.
I have a 3rd part sensor module and would like to integrate its driver to the CircuitPython.
So I have to try adding other drivers and source code to the project.

KevinLee
 
Posts: 4
Joined: Sun Apr 21, 2019 10:18 am

Please be positive and constructive with your questions and comments.