Watchdog resets after update project to Crossworks 3

Comments

20 comments

  • Avatar
    Michael Johnson

    Which device are you using?

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    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. 

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Why did you set the optimisation level to None on GPS.c?

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    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. 

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Sounds like you are missing volatile on memory accesses in this file?

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    So do you believe that WDT resets could be relevant to my gps.c file? If so why does it only happen when compiling using Crossworks version 3.x and not on 2.x ?  

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    And if so why doesn't happen on the rest of my devices AT110 AT210 AT240 which are also using the exact same file ?

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    No Idea - but the fact that a file requires compilation without optimisation suggests there is problem with it.

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    Is there any documentation guide on how to migrate a project from 2.x to 3.x then ?

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    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.

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    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".

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    You'll have to step through the code - check the stack pointer as you go.

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    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) );

     

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    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

     

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    What conflict did you get?

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    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 project

    So 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/inc

    and 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' follow

    Any 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.

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    There's a definition of __aeabi_read_tp in thumb_crt0.s - you should be able to merge this into your local copy.

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    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.6

    The 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.c

    V2.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.

     

    0
    Comment actions Permalink
  • Avatar
    Anastasios Kavoukis

    The files that should be included on the previous post:

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Set a breakpoint on the watchdog interrupt handler and see if you can find any clues when it pings.

    0
    Comment actions Permalink

Please sign in to leave a comment.