tflite-micro icon indicating copy to clipboard operation
tflite-micro copied to clipboard

Hello world: section `.data' can't be allocated in segment 0 LOAD: .text .ARM.exidx .copy.table .zero.table .data

Open asyatrhl opened this issue 11 months ago • 6 comments

Hi, I want to build hello_world example for arm_cortex_m4 using "make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m4 OPTIMIZED_KERNELS=cmsis_nn hello_world" command. But there is an error "section `.data' can't be allocated in segment 0 LOAD: .text .ARM.exidx .copy.table .zero.table .data" How can I solve this? Thanks.

asyatrhl avatar Jan 03 '25 08:01 asyatrhl

Hi @asyatrhl This is not really an "error", more of a weird implementation warning I guess. It should still work even with this message.

If you don't find thats the case then can you provide any further info on where it fails? The output of that make command should still be the hello world binary

ArmRyan avatar Jan 22 '25 14:01 ArmRyan

Hi @asyatrhl, I think hello_world will just build the binary and test_hello_world will actually run the test. Is it working for you?

mansnils avatar Feb 03 '25 13:02 mansnils

Hi @mansnils, when I try to build the hello_world example for arm_cortex_m4 (did not change anything on the cloned repository) the above error still occurs. When I try to build hello_world example for riscv there is no such warning. I want to to build hello_world example and flash it to arm_cortex_m4 on MAX78000 chip. When I try to flash there is also another error occurs which I think depends on this. Warning: Loadable section ".data" outside of ELF segments The target architecture is set to "armv7e-m". (I am using my own linker file for this step.)

asyatrhl avatar Feb 10 '25 09:02 asyatrhl

@asyatrhl as Ryan mentioned the error msg is just a warning. I was able to run your command:

make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m4 OPTIMIZED_KERNELS=cmsis_nn hello_world
echo $?
0

Now if you are using your own linker script I can't reproduce or guarantee it is working. Note also if you want to flash your own HW don't use TARGET=cortex_m_corstone_300 - instead use TARGET=cortex_m_generic. Also not for TARGET=cortex_m_generic you can only build the tflite micro lib and then link it to your application: make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m4 OPTIMIZED_KERNELS=cmsis_nn microlite

mansnils avatar Feb 10 '25 11:02 mansnils

@mansnils When I do not use my own linker there is an error "section `.data' can't be allocated in segment 0 LOAD: .text .ARM.exidx .copy.table .zero.table .data". (as I explained before, i do not change anything, and just run "make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m4 OPTIMIZED_KERNELS=cmsis_nn hello_world").

asyatrhl avatar Feb 10 '25 11:02 asyatrhl

Hi @asyatrhl What happens if you run: make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m4 OPTIMIZED_KERNELS=cmsis_nn hello_world And then immediately after run: echo $? Will it return 0 or not? If not it may be the build command is not working with your own linker.

mansnils avatar Feb 16 '25 13:02 mansnils