Do you mind sharing where did you include these 2 functions (In which c++ file)? If you are using Arduino, you can make used of “malloc” and “free” instead. You can refer to ambpro2_arduino/BLECharacteristic.cpp at dev · ambiot/ambpro2_arduino · GitHub (Line 14 and 18). Previously you got hard fault, it could be because you did not typecast file = malloc(sizeof(FIL)); correctly.
Hi @pammyleong
It seems it was side effect because I often have mem hard fault like that below without clear resolution. What is suspicious that it is impossible to debug rtlk_* functions. E.g.
Breakpoint 1, wifi_disconn_hdl (buf="", buf_len=8, flags=0, userdata=) at /home/[skp]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/asdk/../../../../../component/common/api/wifi/wifi_conf.c:496
496 wifi_link_err_parse(disconn_reason);
(gdb) s
wifi_link_err_parse (reason_code=0) at /home/[skp]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/asdk/../../../../../component/common/api/wifi/wifi_conf.c:395
395 link_err = rltk_wlan_get_link_err();
(gdb) n
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
INT_MemFault_Patch () at /home/[skp/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/asdk/../../../../../component/soc/realtek/amebad/fwlib/ram_hp/rtl8721dhp_app_start.c:230
230 __ASM volatile(
(gdb) info threads
Id Target Id Frame
* 1 Thread 57005 INT_MemFault_Patch () at /home/[skp]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/asdk/../../../../../component/soc/realtek/amebad/fwlib/ram_hp/rtl8721dhp_app_start.c:230
(gdb)
Is it protection against debugging?
Than I checked if I made all correct fires for C++ support in AN, para 2.2. Are the addresses of wrapped functions always the same?
Can those warning be a problem? Why they occur after switching to C++?
./build/ram/httpd.o: warning: multiple common of `RDBuf'
./build/ram/example_fatfs.o: warning: previous common is here
./build/ram/httpd.o: warning: multiple common of `WRBuf'
./build/ram/example_fatfs.o: warning: previous common is here
/home/[skip]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/toolchain/linux/asdk-6.4.1/linux/newlib/bin/../lib/gcc/arm-none-eabi/6.4.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ram_image2.data by 2 bytes
/home/[skip]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/toolchain/linux/asdk-6.4.1/linux/newlib/bin/../lib/gcc/arm-none-eabi/6.4.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ram_image2.bss by 16 bytes
/home/[skip]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/toolchain/linux/asdk-6.4.1/linux/newlib/bin/../lib/gcc/arm-none-eabi/6.4.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ram_image2.bss by 16 bytes
/home/[skip]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/toolchain/linux/asdk-6.4.1/linux/newlib/bin/../lib/gcc/arm-none-eabi/6.4.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ram_image2.bss by 16 bytes
/home/[skip]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/toolchain/linux/asdk-6.4.1/linux/newlib/bin/../lib/gcc/arm-none-eabi/6.4.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ram_image2.bss by 16 bytes
/home/[skip]/Src/Honsel/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/xml/toolchain/linux/asdk-6.4.1/linux/newlib/bin/../lib/gcc/arm-none-eabi/6.4.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .ram_image2.bss by 16 bytes