The linkage extern is declared in the head file. It compiles well in version gcc-arm-none-eabi-9-2020-q2-update.
#ifndef FLASH_H #define FLASH_H #include <stdio.h> #include "pico/stdlib.h" #include "pico/binary_info.h" #include "hardware/spi.h" #include "hardware/flash.h" #define FLASH_TARGET_OFFSET (256 * 1024) void print_buf(const uint8_t *buf, size_t len); extern uint8_t *flashData; #endif
But there are some error in later version.
c:/progra~2/gnuarm~1/102021~1.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/uart.dir/device.c.obj:(.bss.flashData+0x0): multiple definition of `flashData'; CMakeFiles/uart.dir/uart_test_gprs.c.obj:(.bss.flashData+0x0): first defined here collect2.exe: error: ld returned 1 exit status mingw32-make[2]: *** [CMakeFiles\uart.dir\build.make:1366: uart.elf] Error 1 mingw32-make[1]: *** [CMakeFiles\Makefile2:1644: CMakeFiles/uart.dir/all] Error 2 mingw32-make: *** [Makefile:102: all] Error 2
Moving to Compiler specific forum