Watchdog resets after update project to Crossworks 3
Hello,
I am having some troubles since I updated my project from Crossworks 2.3 to Crossworks 3.5 with random watchdogs resets.
I would first like to share some of my notes to convert my solution from 2.3 version to 3.5 version.
1) Delete all references to project included CTL libraries.
2) Either delete included reference to core_cm3 or modify lines:
__ASM volatile ("strexb %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );
__ASM volatile ("strexh %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );
3) Include Either linker_additional_files="$(PackagesDir)/libraries/libctl/lib/libctl$(LibExt).a" or set tasking library to on from project settings (libctl="Yes")
4) Stack size should be set to 1024 bytes
5) Add linker_section_placement_file="$(StudioDir)/targets/flash_placement.xml" to project settings.
6) GPS.c Set optimization level to none
7) Change thumb.s file.
8) Flash placement must be modified to include references to MemorySegment tasking library.
The watchdog restart do not appear instantly after boot, and it takes too long to get triggered. It could take from 2-3 hours to 3 days to get a restart.
I have some code to return the name of the watchdog that was triggered but it doesn't return me the name of the watchdog.
Also I have tried to run same project (same in a matter of source code) compiled by the two Crossworks versions.
1) Same source code but Crossworks 2.3 (Does not restart)
2) Same source code but Crossworks 3.5 (restarts)
I have also included my solution file and some additional files that were edited when I was converting the project.
The project is the AT200.
AST.hzp -> new solution files for version 3.5
thumb_crt0.s
FlashPlacement_APP_FMG.xml
Is there anything else I should also provide to get help on this problem ?
AST.hzp
thumb_crt0.s
FlashPlacement_APP_FMG.xml
-
Project AT200 is on device STM32F101RE
Also I believe that project AT110 AT210 AT240 do not restart but they are on device STM32F103ZE.
I already performed tests on one of the other devices and did not restart but they only run for two days. I will perform the same tests again to make sure.
-
I remember it was "crashing" with the file optimised either WDT reset or Exception. I don't remember the exact behaviour but I remember that without this change the device would fail to start. It was easy to detect because it was happening every time after boot when trying to access the code in file.
-
There are some words in the V3 release notes about the differences. But I would go back to using v2 and turn optimisation on and see if you get similar problems. Then check for lack of volatile in (for example) delay loops and variables used to communicate between interrupt handlers and the main line.
-
The optimisation on gps.c
V2:
<file file_name="astralib/src/gps.c">
<configuration Name="Common" gcc_optimization_level="Optimize For Size"/>
</file>V3:
<file file_name="astralib/src/gps.c" />
on V2 the optimisation was size based. Same optimisation mode crashes on version 3.x so switched to "none".
-
I can confirm some things I was not certain about.
1) The WDT rests only apply on one of my devices (that uses STM32F101RE, all the rest use STM32F103ZE).
2) The exact same project compiled by version V2.3 does not trigger WDT restarts and when compiled by V3.6 it does.
The same project that was converted from V2.3 to V3.6 and was restarting converted again to back to V2.3 and does not restart now.
Changes applied to convert back to V3.6 project to convert it back to V2.3
1) include the tasking files back top the project ctl.zip
2) changed back to the previous thumb file. APP_FMG_thumb_crt0.s
3) Changed my placement file and removed all tdata tbss... file FlashPlacement_APP_FMG
4) modified core_cm3 to
__ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
__ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
-
Is there a way to use my previous tasking library on V3.x the way it was included in my V2.x project by source code and not use the pre-compiled objects that V3.x is using ? I have tried to:
1) libctl="No"
2) remove the path $(PackagesDir)/libraries/libctl/lib/libctl$(LibExt).a from linker_addiotnal_files=""
But was still getting conflicts, then I also tried to:
3) rename the libctl folder C:\Users\myuser\AppData\Local\Rowley Associates Limited\CrossWorks for ARM\v3\packages\libraries
4) but it seems that there is still a linker conflict
-
Some more info and errors:
My include directories on version 3 before was:
$(PackagesDir)/libraries/libctl/include;
$(ProjectDir)/main_app/inc;
$(ProjectDir)/astralib/inc;
$(ProjectDir)/astralib/inc/flash;
$(ProjectDir)/astralib/inc/gps;
$(ProjectDir)/astralib/inc/modem;
$(ProjectDir)/system/inc;
$(ProjectDir)/A1091LIB/inc;
$(ProjectDir)/A1091LIB/inc/accelerometer;
$(ProjectDir)/STM32LIB/inc;
$(ProjectDir)/sdk/inc;
$(ProjectDir)/STM32USB/inc"libctl="Yes"
Replaced: $(PackagesDir)/libraries/libctl/include with $(ProjectDir)/ctl/inc
and re added the ctl src and inc of the projectSo now my CURRENT include dirs are:
$(ProjectDir)/ctl/inc
$(ProjectDir)/main_app/inc
$(ProjectDir)/astralib/inc
$(ProjectDir)/astralib/inc/gps
$(ProjectDir)/astralib/inc/modem
$(ProjectDir)/system/inc
$(ProjectDir)/A1091LIB/inc
$(ProjectDir)/A1091LIB/inc/accelerometer
$(ProjectDir)/STM32LIB/inc
$(ProjectDir)/sdk/inc
$(ProjectDir)/STM32USB/incand not included anything on linker_additional_files=""
no libctl="Yes"Also rolled back my FlashPlacement file to my previous version that doesnt include the extra tdata tbss etc...
The
linker errors"C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/gcc/arm-none-eabi/bin/ld" -X -ereset_handler --omagic -defsym=__vfprintf=__vfprintf_float_long_long -defsym=__vfscanf=__vfscanf_float_long_long_cc --fatal-warnings -EL --gc-sections "-TC:/Firmware/ATnnn/branches/local delete/ATnnn_Main_Development6-to ide 3.5 foward again/AT200 AT200 AST VAR0/AT200.ld" -Map "AT200 AT200 AST VAR0/AT200.map" -u_vectors -o "AT200 AT200 AST VAR0/AT200.elf" --start-group "AT200 AT200 AST VAR0/user_io.o" "AT200 AT200 AST VAR0/ffs.o" "AT200 AT200 AST VAR0/programmer.o" "AT200 AT200 AST VAR0/longcalls.o" "AT200 AT200 AST VAR0/accelerometer.o" "AT200 AT200 AST VAR0/CMA3000.o" "AT200 AT200 AST VAR0/gps.o" "AT200 AT200 AST VAR0/ibutton.o" "AT200 AT200 AST VAR0/jqueue.o" "AT200 AT200 AST VAR0/jwl_c.o" "AT200 AT200 AST VAR0/rtc.o" "AT200 AT200 AST VAR0/serial.o" "AT200 AT200 AST VAR0/stack.o" "AT200 AT200 AST VAR0/uart.o" "AT200 AT200 AST VAR0/watchdog.o" "AT200 AT200 AST VAR0/time_utils.o" "AT200 AT200 AST VAR0/utils.o" "AT200 AT200 AST VAR0/adc.o" "AT200 AT200 AST VAR0/rendezvous.o" "AT200 AT200 AST VAR0/debug.o" "AT200 AT200 AST VAR0/jwl_ctl.o" "AT200 AT200 AST VAR0/nmea.o" "AT200 AT200 AST VAR0/sirf_binary.o" "AT200 AT200 AST VAR0/gps_utils.o" "AT200 AT200 AST VAR0/modem_simcom.o" "AT200 AT200 AST VAR0/card_reader.o" "AT200 AT200 AST VAR0/econ_reader.o" "AT200 AT200 AST VAR0/timers.o" "AT200 AT200 AST VAR0/sq_sen.o" "AT200 AT200 AST VAR0/LIS3DH.o" "AT200 AT200 AST VAR0/core_cm3.o" "AT200 AT200 AST VAR0/misc.o" "AT200 AT200 AST VAR0/stm32f10x_adc.o" "AT200 AT200 AST VAR0/stm32f10x_bkp.o" "AT200 AT200 AST VAR0/stm32f10x_can.o" "AT200 AT200 AST VAR0/stm32f10x_cec.o" "AT200 AT200 AST VAR0/stm32f10x_crc.o" "AT200 AT200 AST VAR0/stm32f10x_dac.o" "AT200 AT200 AST VAR0/stm32f10x_dbgmcu.o" "AT200 AT200 AST VAR0/stm32f10x_dma.o" "AT200 AT200 AST VAR0/stm32f10x_exti.o" "AT200 AT200 AST VAR0/stm32f10x_flash.o" "AT200 AT200 AST VAR0/stm32f10x_fsmc.o" "AT200 AT200 AST VAR0/stm32f10x_gpio.o" "AT200 AT200 AST VAR0/stm32f10x_i2c.o" "AT200 AT200 AST VAR0/stm32f10x_iwdg.o" "AT200 AT200 AST VAR0/stm32f10x_pwr.o" "AT200 AT200 AST VAR0/stm32f10x_rcc.o" "AT200 AT200 AST VAR0/stm32f10x_rtc.o" "AT200 AT200 AST VAR0/stm32f10x_sdio.o" "AT200 AT200 AST VAR0/stm32f10x_spi.o" "AT200 AT200 AST VAR0/stm32f10x_tim.o" "AT200 AT200 AST VAR0/stm32f10x_usart.o" "AT200 AT200 AST VAR0/stm32f10x_wwdg.o" "AT200 AT200 AST VAR0/ctl.o" "AT200 AT200 AST VAR0/ctl_board.o" "AT200 AT200 AST VAR0/ctl_bq.o" "AT200 AT200 AST VAR0/ctl_cm3.o" "AT200 AT200 AST VAR0/ctl_cm3_int.o" "AT200 AT200 AST VAR0/ctl_evt.o" "AT200 AT200 AST VAR0/ctl_libc.o" "AT200 AT200 AST VAR0/ctl_mem_blk.o" "AT200 AT200 AST VAR0/ctl_mq.o" "AT200 AT200 AST VAR0/ctl_mutex.o" "AT200 AT200 AST VAR0/ctl_sem.o" "AT200 AT200 AST VAR0/main_ctl.o" "AT200 AT200 AST VAR0/comm_task.o" "AT200 AT200 AST VAR0/event_monitor.o" "AT200 AT200 AST VAR0/ota.o" "AT200 AT200 AST VAR0/crypto.o" "AT200 AT200 AST VAR0/system.o" "AT200 AT200 AST VAR0/hw.o" "AT200 AT200 AST VAR0/low_power.o" "AT200 AT200 AST VAR0/APP_FMG_Startup.o" "AT200 AT200 AST VAR0/APP_FMG_thumb_crt0.o" "AT200 AT200 AST VAR0/events.o" "AT200 AT200 AST VAR0/defaults.o" "AT200 AT200 AST VAR0/command_parser.o" "AT200 AT200 AST VAR0/reports.o" "AT200 AT200 AST VAR0/settings.o" "AT200 AT200 AST VAR0/canbus.o" "AT200 AT200 AST VAR0/j1939.o" "AT200 AT200 AST VAR0/j1979.o" "AT200 AT200 AST VAR0/nv.o" "AT200 AT200 AST VAR0/stacks.o" "AT200 AT200 AST VAR0/serial_comms.o" "AT200 AT200 AST VAR0/comms.o" "AT200 AT200 AST VAR0/STM32F10x_ctl.o" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libcm_v7m_t_le_eabi.a" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libdebugio_mempoll_v7m_t_le_eabi.a" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libm_v7m_t_le_eabi.a" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libc_v7m_t_le_eabi.a" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libcpp_v7m_t_le_eabi.a" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libdebugio_v7m_t_le_eabi.a" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libvfprintf_v7m_t_le_eabi.o" "C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libvfscanf_v7m_t_le_eabi.o" --end-group
AT200 AT200 AST VAR0/AT200.elf: section .tbss.__RAL_strtok_state lma 0xe000e000 adjusted to 0xe000e004
C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libc_v7m_t_le_eabi.a(libc2.o): In function `__strtoul':
libc2.c:(.text.libc.__strtoul+0xb4): undefined reference to `__aeabi_read_tp'
C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libc_v7m_t_le_eabi.a(libc2.o): In function `__aeabi_errno_addr':
libc2.c:(.text.libc.__aeabi_errno_addr+0x2): undefined reference to `__aeabi_read_tp'
C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libc_v7m_t_le_eabi.a(libc2.o): In function `strtok':
libc2.c:(.text.libc.strtok+0x8): undefined reference to `__aeabi_read_tp'
libc2.c:(.text.libc.strtok+0x54): undefined reference to `__aeabi_read_tp'
libc2.c:(.text.libc.strtok+0x60): undefined reference to `__aeabi_read_tp'
C:/Program Files (x86)/Rowley Associates Limited/CrossWorks for ARM 3.6/lib/libc_v7m_t_le_eabi.a(libc2.o):libc2.c:(.text.libc.strtol+0x6a): more undefined references to `__aeabi_read_tp' followAny idea what I am missing ?
What I'm trying to achieve is to use the CrossWorks 3.6 but using my old CTL library exactly the same way as was included on my V2.3 project.
Please note that I have also removed from placement file the tdata, tbxxx referances as they were not there on version 2.3. -
Hi,
I managed to use the previous tasking library and the problem still occurs.
I would like to summarise my finding about my problem.I have two versions of the project
1) A project that can be compiled on version 2.3
2) A project that can be compiled on version 3.6The code on the projects is exactly the same.
1) If i compile the project from version 2.3 it runs without any problem (no WDT restarts).
2) If i compile the project from version 3.6 and it WDT restarts after few hours of running.
Differences between the projects:
1) core_cm3.cV2.3
__ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
__ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );V3.6
__ASM volatile ("strexb %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );
__ASM volatile ("strexh %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );
2) FlashPlacement
Version 2.3 FlashPlacement_APP_FMG_OLD
Version 3.6 FlashPlacement_APP_FMG_NEW
3) Thumbs file
Version 2.3 APP_FMG_thumb_crt0_OLD
Version 3.6 APP_FMG_thumb_crt0_new(Also tried both flash and ram placement of ctl)
I really can't see any other differences.
Some more info that could help you understand the sequence of my tests.I had a version of my source code lets call it version A, that was running on Crossworks 2.3. (no restarts).
Then I moved to version B that runs on version Crossworks 3.6 (restarts).
I thought it was some of my code changes. But I tried to compile my version B with Crossworks 2.3 (no restarts).
Therefore I believed that it was the CTL tasking library that makes the difference so i compiled my version B on Crossworks 3.6 again but using the CTL library from Version A instead of pre-compiled libraries. (still restarts)It appears that the only difference now between the two are the changes above. Can you identify anything that looks abnormal on the above changes ?
Please help and advice asap because it could take two days to test the changes.
Please sign in to leave a comment.
Comments
20 comments