porting nRF52 project from IAR to ARMGCC

Hi. I have a working IAR project based on the nrf52 SDK \nordic\examples\ble_peripheral\ble_app_uart. i am attempting to port the project to ARMGCC using VSCode. I am at a stage in the port where all the files compile and link and I am at the main() stepping in and out of functions using the GDB. i come across a function "localtime" and have a HARDFAULT. I verified the input parameters are valid.

thanks in advance.

Barry

Parents
  • You don't specify what version of the library you are using. Also, this stuff gets deep rather quickly and difficult to file without every configuration. 
    Is it possible to single step INTO the function? 

    My quick guess is that something inside the function went from a heap/stack type variable to a flash variable and something is trying to write to it. I saw something like this happen between 2.7.0 and 2.91 - there was a nice little macro that made a variable for me, but someone added a "const" to it inside the SDK and my code wrote to this generated variable. CRASH
    A M 

  • hello 

    i debugged my code in IAR when reaching the statement:  struct tm *t = localtime(&hitless_ptr()->rtc_var.m_time), I looked for the declaration of localtime and IAR took me to C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\arm\inc\c, file time32.h. In ARMGCC, compilation and linking go without error or warning, but while debugging in GDB and stepping over localtime, I get the hardfault.

    Thanks in advance.

  • Hi

    Do you also see this hardfault if you don't step through the code in debugging? If you're trying to step through time sensitive operations the application will hardfault as the SoftDevice will notice the timing is off and go into a fault state as you can't do Bluetooth LE operation without correct timing.

    Best regards,

    Simon

  • hi Simon,

    No, I don't get a HARDFAULT when stepping through the code until I reach the LOCALTIME() function. Then I got a HARDFAULT; I forced a restart and began working again until I reached the LOCALTIME() function.

    i am noticing that all the time function while building without errors; Intellisense is complaining.

    Thanks in advance.

    Barry

  • I have seen this before. This most likely happens when you use incompatible lib that defines this localtime. Are you using newlibc or something else. Check if the library you linked is compatible with the compiler you are using.

Reply Children
No Data
Related