Hi,
I am trying to implement ECDSA sign and verify algorithm using mbedtls.
IDE using : Simplicity Studio
Target board : BGM13P32 Blue Gecko Module Radio Board (BRD4306B)
There are example projects in simplicity studio which implement mbedtls ecdsa in a single threaded application. But I want to implement this in threaded environment using micrium RTOS.
I have referred below link but still I am getting below error.
Any help is really appreciated.
Console output :
08:38:23 **** Incremental Build of configuration GNU ARM v10.2.1 - Default for project iostream_usart_kernel_micriumos ****
make -j8 all
Building file: …/app.c
Invoking: GNU ARM C Compiler
arm-none-eabi-gcc -g3 -gdwarf-2 -mcpu=cortex-m4 -mthumb -std=c99 ‘-DDEBUG_EFM=1’ ‘-DBGM13P32F512GA=1’ ‘-DconfigNUM_SDK_THREAD_LOCAL_STORAGE_POINTERS=2’ ‘-DSL_COMPONENT_CATALOG_PRESENT=1’ ‘-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>’ ‘-DMBEDTLS_PSA_CRYPTO_CLIENT=1’ ‘-DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=<psa_crypto_config.h>’ -I"D:\Project\P_2101_Goodman_Ble_Module\Firmware\Sample_codes\Code\iostream_usart_kernel_micriumos" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/Device/SiliconLabs/BGM13/Include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/common/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//hardware/board/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/CMSIS/Include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/CMSIS/RTOS2/Include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/service/device_init/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/emdrv/common/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/emlib/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/service/iostream/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//util/third_party/crypto/mbedtls/include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//util/third_party/crypto/sl_component/sl_mbedtls_support/config" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//util/third_party/crypto/mbedtls/library" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//util/third_party/crypto/sl_component/sl_alt/include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//util/third_party/crypto/sl_component/sl_mbedtls_support/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/micrium_os/common/source" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/micrium_os/common/include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/micrium_os/cpu/include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/micrium_os/ports/source" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/micrium_os" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/micrium_os/kernel/source" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/micrium_os/kernel/include" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_usart" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/emdrv/nvm3/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//util/third_party/crypto/sl_component/sl_psa_driver/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//util/silicon_labs/silabs_core/memory_manager" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/common/toolchain/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/service/system/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/service/sleeptimer/inc" -I"C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/service/udelay/inc" -I"D:\Project\P_2101_Goodman_Ble_Module\Firmware\Sample_codes\Code\iostream_usart_kernel_micriumos\autogen" -I"D:\Project\P_2101_Goodman_Ble_Module\Firmware\Sample_codes\Code\iostream_usart_kernel_micriumos\config" -Os -Wall -Wextra -fno-builtin -ffunction-sections -fdata-sections -imacrossl_gcc_preinclude.h -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -c -fmessage-length=0 -MMD -MP -MF"app.d" -MT"app.o" -o “app.o” “…/app.c”
Finished building: …/app.c
Building target: iostream_usart_kernel_micriumos.axf
Invoking: GNU ARM C Linker
arm-none-eabi-gcc -g3 -gdwarf-2 -mcpu=cortex-m4 -mthumb -T “D:\Project\P_2101_Goodman_Ble_Module\Firmware\Sample_codes\Code\iostream_usart_kernel_micriumos/autogen/linkerfile.ld” -Xlinker --gc-sections -Xlinker -Map=“iostream_usart_kernel_micriumos.map” -mfpu=fpv4-sp-d16 -mfloat-abi=softfp --specs=nano.specs -o iostream_usart_kernel_micriumos.axf -Wl,–start-group “./app.o” “./app_ecdsa.o” “./app_iostream_usart.o” “./dummy_entropy.o” “./main.o” “./autogen/sl_board_default_init.o” “./autogen/sl_device_init_clocks.o” “./autogen/sl_event_handler.o” “./autogen/sl_iostream_handles.o” “./autogen/sl_iostream_init_usart_instances.o” “./gecko_sdk_3.2.1/hardware/board/src/sl_board_control_gpio.o” “./gecko_sdk_3.2.1/hardware/board/src/sl_board_init.o” “./gecko_sdk_3.2.1/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_usart/sl_mx25_flash_shutdown.o” “./gecko_sdk_3.2.1/platform/CMSIS/RTOS2/Source/os_systick.o” “./gecko_sdk_3.2.1/platform/Device/SiliconLabs/BGM13/Source/GCC/startup_bgm13.o” “./gecko_sdk_3.2.1/platform/Device/SiliconLabs/BGM13/Source/system_bgm13.o” “./gecko_sdk_3.2.1/platform/common/src/sl_slist.o” “./gecko_sdk_3.2.1/platform/common/src/sli_cmsis_os2_ext_task_register.o” “./gecko_sdk_3.2.1/platform/common/toolchain/src/sl_memory.o” “./gecko_sdk_3.2.1/platform/emdrv/nvm3/src/nvm3_default_common_linker.o” “./gecko_sdk_3.2.1/platform/emdrv/nvm3/src/nvm3_hal_flash.o” “./gecko_sdk_3.2.1/platform/emdrv/nvm3/src/nvm3_lock.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_assert.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_cmu.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_core.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_crypto.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_emu.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_gpio.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_msc.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_rtcc.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_system.o” “./gecko_sdk_3.2.1/platform/emlib/src/em_usart.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/kal/kal_kernel.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/lib/lib_ascii.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/lib/lib_mem.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/lib/lib_str.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/logging/logging.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/ring_buf/ring_buf.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/rtos/rtos_err_str.o” “./gecko_sdk_3.2.1/platform/micrium_os/common/source/rtos/rtos_utils.o” “./gecko_sdk_3.2.1/platform/micrium_os/cpu/source/cpu_core.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/cmsis_os2.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_cfg_app.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_core.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_dbg.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_flag.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_mon.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_msg.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_mutex.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_prio.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_q.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_sem.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_stat.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_task.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_time.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_tmr.o” “./gecko_sdk_3.2.1/platform/micrium_os/kernel/source/os_var.o” “./gecko_sdk_3.2.1/platform/micrium_os/ports/source/generic/arm_cpu_dwt_ts.o” “./gecko_sdk_3.2.1/platform/micrium_os/ports/source/gnu/armv7m_cpu_a.o” “./gecko_sdk_3.2.1/platform/micrium_os/ports/source/gnu/armv7m_os_cpu_a.o” “./gecko_sdk_3.2.1/platform/micrium_os/ports/source/gnu/armv7m_os_cpu_c.o” “./gecko_sdk_3.2.1/platform/service/device_init/src/sl_device_init_dcdc_s1.o” “./gecko_sdk_3.2.1/platform/service/device_init/src/sl_device_init_emu_s1.o” “./gecko_sdk_3.2.1/platform/service/device_init/src/sl_device_init_hfxo_s1.o” “./gecko_sdk_3.2.1/platform/service/device_init/src/sl_device_init_lfxo_s1.o” “./gecko_sdk_3.2.1/platform/service/device_init/src/sl_device_init_nvic.o” “./gecko_sdk_3.2.1/platform/service/iostream/src/sl_iostream.o” “./gecko_sdk_3.2.1/platform/service/iostream/src/sl_iostream_retarget_stdio.o” “./gecko_sdk_3.2.1/platform/service/iostream/src/sl_iostream_uart.o” “./gecko_sdk_3.2.1/platform/service/iostream/src/sl_iostream_usart.o” “./gecko_sdk_3.2.1/platform/service/sleeptimer/src/sl_sleeptimer.o” “./gecko_sdk_3.2.1/platform/service/sleeptimer/src/sl_sleeptimer_hal_prortc.o” “./gecko_sdk_3.2.1/platform/service/sleeptimer/src/sl_sleeptimer_hal_rtcc.o” “./gecko_sdk_3.2.1/platform/service/system/src/sl_system_init.o” “./gecko_sdk_3.2.1/platform/service/system/src/sl_system_kernel.o” “./gecko_sdk_3.2.1/platform/service/udelay/src/sl_udelay.o” “./gecko_sdk_3.2.1/platform/service/udelay/src/sl_udelay_armv6m_gcc.o” “./gecko_sdk_3.2.1/util/silicon_labs/silabs_core/memory_manager/sl_malloc.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/aes.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/asn1parse.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/asn1write.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/bignum.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/ctr_drbg.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/ecdh.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/ecdsa.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/ecp.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/ecp_curves.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/entropy.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/entropy_poll.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/error.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/hmac_drbg.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/platform.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/platform_util.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/psa_crypto_client.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/sha256.o” “./gecko_sdk_3.2.1/util/third_party/crypto/mbedtls/library/threading.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_alt/source/sl_entropy_nvseed.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_alt/source/sl_mbedtls.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_mbedtls_support/src/crypto_aes.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_mbedtls_support/src/crypto_ecp.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_mbedtls_support/src/mbedtls_sha.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_psa_driver/src/crypto_management.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_psa_driver/src/sli_crypto_transparent_driver_aead.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_psa_driver/src/sli_crypto_transparent_driver_cipher.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_psa_driver/src/sli_crypto_transparent_driver_hash.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_psa_driver/src/sli_crypto_transparent_driver_mac.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_psa_driver/src/sli_psa_driver_common.o” “./gecko_sdk_3.2.1/util/third_party/crypto/sl_component/sl_psa_driver/src/sli_psa_driver_init.o” “C:/SiliconLabs/SimplicityStudio/v5/developer/sdks/gecko_sdk_suite/v3.2//platform/emdrv/nvm3/lib/libnvm3_CM4_gcc.a” -lgcc -lc -lnosys -lm -Wl,–end-group -Wl,–start-group -lgcc -lc -lnosys -Wl,–end-group
c:/siliconlabs/simplicitystudio/v5/developer/toolchains/gnu_arm/10.2_2020q4/bin/…/lib/gcc/arm-none-eabi/10.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: ./main.o: in function main': D:\Project\P_2101_Goodman_Ble_Module\Firmware\Sample_codes\Code\iostream_usart_kernel_micriumos\GNU ARM v10.2.1 - **Default/../main.c:42: undefined reference to
THREADING_setup’**
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:60: iostream_usart_kernel_micriumos.axf] Error 1
“make -j8 all” terminated with exit code 2. Build might be incomplete.
08:38:26 Build Failed. 3 errors, 0 warnings. (took 2s.879ms)
Code :
******************************************************************************/
#include “mbedtls_config.h”
#include “sl_component_catalog.h”
#include “sl_system_init.h”
#include “app.h”
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include “sl_power_manager.h”
#endif
#if defined(SL_CATALOG_KERNEL_PRESENT)
#include “sl_system_kernel.h”
#else // SL_CATALOG_KERNEL_PRESENT
#include “sl_system_process_action.h”
#endif // SL_CATALOG_KERNEL_PRESENT
#include “mbedtls/config.h”
#include “mbedtls/check_config.h”
int main(void)
{
// Initialize Silicon Labs device, system, service(s) and protocol stack(s).
// Note that if the kernel is present, processing task(s) will be created by
// this call.
sl_system_init();
// Enable Micrium OS support
#if defined ( MBEDTLS_THREADING_C )
THREADING_setup();
#endif
// Initialize the application. For example, create periodic timer(s) or
// task(s) if the kernel is present.
app_init();
#if defined(SL_CATALOG_KERNEL_PRESENT)
// Start the kernel. Task(s) created in app_init() will start running.
sl_system_kernel_start();
#else // SL_CATALOG_KERNEL_PRESENT
while (1) {
// Do not remove this call: Silicon Labs components process action routine
// must be called from the super loop.
sl_system_process_action();
// Application process.
app_process_action();
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
// Let the CPU go to sleep if the system allows it.
sl_power_manager_sleep();
#endif
}
#endif // SL_CATALOG_KERNEL_PRESENT
}
Macros are defined in mbedtls_config.h.
#define MBEDTLS_THREADING_C
#define MBEDTLS_THREADING_ALT
#define MBEDTLS_MICRIUM
#undef MBEDTLS_NET_C
#undef MBEDTLS_TIMING_C