Ceedling: All tests return error of bad memory access

Hello,

My ceedling tests run and pass using GCC and what I would call the default project.yml file. I am trying to get my tests running with an external toolset which is generated from a Yocto build.

Every test in my project now fails giving the error badMemory

To build my project I have to run source to setup the environment. source /opt/fsl-imx-fb/5.10-hardknott/environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi

I then open eclipse and am able to build/deploy my application. I am attempting to follow the same steps in my project.yml file (attached). When eclipse builds my application it builds and links as follows.

Building file: ../src/scheduler.c
Invoking: Cross GCC Compiler
arm-poky-linux-gnueabi-gcc  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-fb/5.10-hardknott/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -I"/home/michael/Documents/MAIN_Application/MAIN_layers/meta-MAINapplication/recipes-core/MAIN_Application/files/MAIN_Application/include" -I"/home/michael/Documents/MAIN_Application/MAIN_layers/meta-MAINapplication/recipes-core/MAIN_Application/files/MAIN_Application/include/comms" -I/opt/fsl-imx-fb/5.10-hardknott/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include -I"/home/michael/Documents/MAIN_Application/MAIN_layers/meta-MAINapplication/recipes-core/MAIN_Application/files/MAIN_Application/include/utilities" -O0 -O -g3 -Wall -c -fmessage-length=0 --sysroot=/opt/fsl-imx-fb/5.10-hardknott/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -MMD -MP -MF"src/scheduler.d" -MT"src/scheduler.o" -o "src/scheduler.o" "../src/scheduler.c"
Finished building: ../src/scheduler.c
Building target: MAIN_Application
Invoking: Cross GCC Linker
arm-poky-linux-gnueabi-gcc  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-fb/5.10-hardknott/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now --sysroot=/opt/fsl-imx-fb/5.10-hardknott/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -o "MAIN_Application"  ./test/test_utilities/test_logger.o ./test/test_utilities/test_ring_buffer.o ./test/test_utilities/test_time_conversions.o  ./test/support/mock_ioctl.o ./test/support/mock_pthread.o ./test/support/mock_socket.o ./test/support/mock_unistd.o  ./test/comms/test_can.o  ./test/test_scheduler.o  ./src/utilities/logger.o ./src/utilities/ring_buffer.o ./src/utilities/time_conversions.o  ./src/comms/MAIN_can.o  ./src/main.o ./src/scheduler.o   -lpthread -lsocketcan
Finished building target: MAIN_Application

My tests compile and link but never successfully run. It seems the error is related to how the code is linked. Can anyone see an issue? project.txt

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 45 (19 by maintainers)

Most upvoted comments

I believe I’ve misled you. Try :treat_externs: (note the s)

Ah. That last point might be the key. Try adding this to your project.yml:

:cmock:
    :treat_extern: :include