Closed bengtb closed 3 years ago
That's a classical compiling arm cortex m code with a desktop compiler error message I think.
Have you installed arm-none-eabi-gcc? Can you manually specify the compiler for cmake on the command line?
Raspberry pi Foundation have a pdf for getting started with development that lists the toolchain instructions which might be handy to follow.
There are also some toolchain files in the Pico SDK somewhere that you could try loading use -DCMAKE_TOOLCHAIN_FILE
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 227977]
I'll try doing this on my Raspberry Pi 4 instead of my Mac that has much more software installed. I'll be back.
On the Raspberry Pi 4 it built without a problem. Though it will not blink. Does this look OK:
$ arm-none-eabi-gcc --version arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ arm-none-eabi-size hello_world.elf text data bss dec hex filename 25228 24 52572 77824 13000 hello_world.elf $ arm-none-eabi-objdump -h hello_world.elf
hello_world.elf: file format elf32-littlearm
Sections: Idx Name Size VMA LMA File off Algn 0 .boot2 00000100 10000000 10000000 00010000 20 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .text 00005710 10000100 10000100 00010100 24 CONTENTS, ALLOC, LOAD, READONLY, CODE 2 .rodata 000000d4 10005810 10005810 00015810 22 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .binary_info 00000018 100058e4 100058e4 000158e4 22 CONTENTS, ALLOC, LOAD, DATA 4 .ram_vector_table 000000c0 20000000 20000000 00020a68 22 CONTENTS 5 .data 000009a8 200000c0 100058fc 000200c0 24 CONTENTS, ALLOC, LOAD, CODE 6 .uninitialized_data 00000000 20000a68 20000a68 00020b28 20 CONTENTS 7 .scratch_x 00000000 20040000 20040000 00020b28 20 CONTENTS 8 .scratch_y 00000000 20041000 20041000 00020b28 20 CONTENTS 9 .bss 0000cd5c 20000a68 20000a68 00020a68 22 ALLOC 10 .heap 00000800 2000d7c4 2000d7c4 00020b28 22 CONTENTS, READONLY 11 .stack_dummy 00000800 20041000 20041000 00021340 25 CONTENTS, READONLY 12 .ARM.attributes 00000028 00000000 00000000 00021b40 20 CONTENTS, READONLY 13 .comment 000000ae 00000000 00000000 00021b68 20 CONTENTS, READONLY 14 .debug_line 00000ef4 00000000 00000000 00021c16 20 CONTENTS, READONLY, DEBUGGING 15 .debug_info 000065f9 00000000 00000000 00022b0a 20 CONTENTS, READONLY, DEBUGGING 16 .debug_abbrev 0000151f 00000000 00000000 00029103 20 CONTENTS, READONLY, DEBUGGING 17 .debug_aranges 00000158 00000000 00000000 0002a628 23 CONTENTS, READONLY, DEBUGGING 18 .debug_str 00000ac7 00000000 00000000 0002a780 20 CONTENTS, READONLY, DEBUGGING 19 .debug_loc 0000170e 00000000 00000000 0002b247 20 CONTENTS, READONLY, DEBUGGING 20 .debug_frame 000001f0 00000000 00000000 0002c958 22 CONTENTS, READONLY, DEBUGGING 21 .debug_ranges 00000070 00000000 00000000 0002cb48 20 CONTENTS, READONLY, DEBUGGING
Any idea what the next step in the analysis could be?
Thanks in advance /Bengt
I'd halt the MCU and see what its trying to do whilst running or you can upload your elf file and I will take a look to see if it hard faults anywhere.
I did verify that the downloaded file on the pico is the same as the uf2 and elf ones using picotool.
Now I have soldered the wires and run it under the debugger. It does crash:
(gdb) c
Continuing.
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000178 msp: 0x20041f00
Thread 1 hit Breakpoint 4, isr_hardfault () at /home/pi/Desktop/RPI-pico-FreeRTOS/pico-sdk/src/rp2_common/pico_standard_link/crt0.S:92
92 decl_isr_bkpt isr_hardfault
This is the backtrace:
(gdb) bt
#0 isr_hardfault () at /home/pi/Desktop/RPI-pico-FreeRTOS/pico-sdk/src/rp2_common/pico_standard_link/crt0.S:92
#1 <signal handler called>
#2 0x2000d2c0 in uxTimerTaskStack.4274 ()
#3 0x2000cff0 in ucHeap ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
I have attached the .elf-file.
Thank you for your patience.
No Problem, I have found an issue . It crashes in release mode when configSUPPORT_STATIC_ALLOCATION 1 is enabled. I have pushed a patch config to Bugfix/HardFaultsUnderReleaseMode
I have also made another commit and found the source of the problem I believe. It seems like on Cortex M0, the FreeRTOS interrupt functions must be called directly from the vector table.
I checked out the Bugfix/HardFaultsUnderReleaseMode branch and built it. I haven't had time to experiment anything yet, but it does build and blink.
Thank you!
I cloned this repo and did a
git submodule update --init --recursive
in the newly created directory.After creating a
build
directory and runningcmake -S . -B build
I change directory to thebuild
directory.When building using
make
I get these errors:What did I do wrong?