ceedling with freertos linking error

459 views
Skip to first unread message

Adarsh Kushwaha

unread,
Dec 14, 2020, 5:41:33 AM12/14/20
to ThrowTheSwitch Forums
Linking test_systemHealth.out...
build/test/out/c/systemHealth.o: In function `systemHealthTask':
systemHealth.c:(.text+0x1e7): undefined reference to `xStatusEventGroup'
systemHealth.c:(.text+0x1f4): undefined reference to `xEventGroupSetBits'
systemHealth.c:(.text+0x21d): undefined reference to `vTaskDelay'
build/test/out/c/systemHealth.o: In function `systemHealthMonitorInit':
systemHealth.c:(.text+0x25b): undefined reference to `xTaskCreate'
build/test/out/c/systemHealth.o: In function `initFilterNVS':
systemHealth.c:(.text+0x3af): undefined reference to `esp_err_to_name'
collect2: error: ld returned 1 exit status
ERROR: Shell command failed.

Can anyone please tell how to resolve this its really important for me

Nick Nerovny

unread,
Dec 14, 2020, 6:09:45 AM12/14/20
to throwth...@googlegroups.com
Do you link a target build or some test?

If you build test:
I think you may need to either include FreeRTOS source files into the list of test support files or (preferably) let Ceedling create mocks (e.g. write #include "mock_task.h" in the test file). Meanwhile, I don't think that you should mix thread function definition with calls of FreeRTOS-specific functions in single source file. You may use macro-guards (#ifndef TEST) in such a case, or write your program FreeRTOS-agnostic, providing some compatibility layer.

If you build target:
Just simply include task.c and any other needed FreeRTOS source files into the source file list.

пн, 14 дек. 2020 г. в 13:41, Adarsh Kushwaha <adarshk...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this group and stop receiving emails from it, send an email to throwtheswitc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/throwtheswitch/505bab06-5a0d-40f2-adcd-487594688f9en%40googlegroups.com.

Adarsh Kushwaha

unread,
Dec 14, 2020, 8:32:00 AM12/14/20
to ThrowTheSwitch Forums
My project.yml file looks like this

---

# Notes:
# This is a fully tested project that demonstrates the use
# of a timer ISR to blink the on board LED of an Arduino UNO
:project:
  :use_exceptions: FALSE
  :use_test_preprocessor: FALSE
  :use_auxiliary_dependencies: TRUE
  :build_root: build
  :release_build: TRUE
  :test_file_prefix: test_

#You'll have to specify these
#:environment:
#  - :mcu: atmega328p
#  - :f_cpu: 16000000UL
#  - :serial_port: COM8  #change this to the serial port you are using!!!
#  - :objcopy: avr-objcopy
  # Uncomment these lines if you are using windows and don't have these tools in your path
  # - :path:
    # - C:\mingw\bin
    # - C:\WinAVR-20100110\bin
    # - C:\WinAVR-20100110\utils\bin
    # - #{ENV['PATH']}

:extension:
  :executable: .out

:release_build:
  :output: uvc_controller

:paths:
  :test:
    - +:test/app/uvc/**
    - -:test/support
  :source:
    - src/app/uvc/*
    - src/app/common/*
    - src/drivers/hal/esp32/*
    - src/platform/board/*
#    - freertos/freertos_kernel/**
  :include:
    - config/
    - freertos/vendors/espressif/boards/esp32/aws_tests/
    - freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/include/
    - freertos/freertos_kernel/include/
    - freertos/vendors/espressif/boards/esp32/components/freertos/include/
    - freertos/vendors/espressif/esp-idf/components/log/include/
    - freertos/vendors/espressif/esp-idf/components/esp32/include/
    - freertos/vendors/espressif/esp-idf/components/driver/include/
    - freertos/vendors/espressif/esp-idf/components/nvs_flash/include/
    - freertos/vendors/espressif/esp-idf/components/fatfs/test_fatfs_host/sdkconfig/
    - freertos/vendors/espressif/esp-idf/components/esp32/include/
    - freertos/vendors/espressif/esp-idf/components/soc/esp32/include/
    - freertos/vendors/espressif/esp-idf/components/newlib/include/
    - freertos/vendors/espressif/esp-idf/components/soc/include/
    - freertos/vendors/espressif/esp-idf/components/esp_ringbuf/include/
    - freertos/vendors/espressif/esp-idf/components/heap/include/
  :support:
    - test/support
  :libraries: []

#:attributes:
#  - PRIVILEGED_FUNCTION
#:strippables:
#  - PRIVILEGED_FUNCTION

:defines:
  # in order to add common defines:
  #  1) remove the trailing [] from the :common: section
  #  2) add entries to the :common: section (e.g. :test: has TEST defined)
  :common: &common_defines [UNITY_NO_WEAK]
  :test:
    - *common_defines
    - TEST
    - UNITY_OUTPUT_COLOR #this is just here to make sure it gets removed by ceedling
  :test_preprocess:
    - *common_defines
    - TEST
#:tools:
#  :test_compiler:
#     :executable: xtensa-esp32-elf-gcc #exists in system search path
#     :arguments:
#        - -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE               #expands to -I search paths
#        - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR   #expands to -I search paths
#        - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR  #expands to all -D defined symbols
#        - -c ${1}                       #source code input file (Ruby method call param list sub)
#        - -o ${2}                       #object file output (Ruby method call param list sub)
#  :test_linker:
#     :executable: C:\Program Files\Espressif\ESP-IDF Tools\tools\xtensa-esp32-elf\bin  #absolute file path
#     :arguments:
#        - '"${1}"'
#        - -o "${2}"

:tools:
  :test_compiler:
     :executable: gcc #exists in system search path
     :arguments:
        - -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE               #expands to -I search paths
        - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR   #expands to -I search paths
        - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR  #expands to all -D defined symbols
        - -c ${1}                       #source code input file (Ruby method call param list sub)
        - -o ${2}                       #object file output (Ruby method call param list sub)
  :test_linker:
     :executable: gcc  #absolute file path
     :arguments:
        - '"${1}"'
        - -lm
        - -lc
        - -o "${2}"

:cmock:
  :mock_prefix: mock_
  :when_no_prototypes: :warn
  :enforce_strict_ordering: TRUE
  :plugins:
    - :ignore
    - :ignore_arg
    - :expect_any_args
    - :array
    - :callback
    - :return_thru_ptr
  :callback_include_count: true
  :callback_after_arg_check: false
  :treat_as:
    uint8:    HEX8
    uint16:   HEX16
    uint32:   UINT32
    int8:     INT8
    bool:     UINT8
    CK_ULONG_PTR: UINT32*
  :attributes:
    - PRIVILEGED_FUNCTION
  :strippables:
    - PRIVILEGED_FUNCTION
:gcov:
  :reports:
    - HtmlBasic
    - HtmlDetailed
  :gcovr:
    :html_medium_threshold: 75
    :html_high_threshold: 90

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

:plugins:
  :load_paths:
    - ../tools/vendor/ceedling/plugins
  :enabled:
    - stdout_pretty_tests_report
    - module_generator
    - xml_tests_report
    - gcov
...


Suryagiridhar Kenguva

unread,
Jun 10, 2022, 1:52:57 AM6/10/22
to ThrowTheSwitch Forums
Hi Adarsh,

I am trying to setup ceedling on esp32 and having issues, were you able to set it up? The comments on various forums made me think if it is viable? I want to make sure I don't spend more time on it if it isn't going to work and rather see if I can find other options for unit testing.

Reply all
Reply to author
Forward
0 new messages