This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

crashing from _start without even entering into main() function

Hi,

I am using nrf52832 custom board and sdk17.2.0.

My application is a Freertos application. I see that my application is going to hardfault from _start without entering into the main() function.

Attached sdk_config.h , FreeRTOSConfig.h and the screenshot of the hardfault for reference.

Can someone please help me to resolve the issue?

 8358.FreeRTOSConfig.h6215.sdk_config.h

  • that didn't solve the issue.

    rtc_t nowTime;

    struct tm t1;

    uint32_t get_current_time(void)
    {
    get_time(&nowTime);

    // struct tm t1 = {.tm_year = RTC_Bcd2ToByte(nowTime.year) + BASE_YEAR,
    // .tm_mon = RTC_Bcd2ToByte(nowTime.month) - 1, /* In C, Jan = 0 */
    // .tm_mday = RTC_Bcd2ToByte(nowTime.days),
    // .tm_wday = RTC_Bcd2ToByte(nowTime.weekDay),
    // .tm_hour = RTC_Bcd2ToByte(nowTime.hour),
    // .tm_min = RTC_Bcd2ToByte(nowTime.min),
    // .tm_sec = RTC_Bcd2ToByte(nowTime.sec)};

    t1.tm_year = RTC_Bcd2ToByte(nowTime.year) + BASE_YEAR,
    t1.tm_mon = RTC_Bcd2ToByte(nowTime.month) - 1, /* In C, Jan = 0 */
    t1.tm_mday = RTC_Bcd2ToByte(nowTime.days),
    t1.tm_wday = RTC_Bcd2ToByte(nowTime.weekDay),
    t1.tm_hour = RTC_Bcd2ToByte(nowTime.hour),
    t1.tm_min = RTC_Bcd2ToByte(nowTime.min),
    t1.tm_sec = RTC_Bcd2ToByte(nowTime.sec);

    return (mktime(&t1));

    }

    And same issue is coming even on calling the below set current time function, with ctime and localtime. With this what i observe is there is some issue using the time.h functions. Do i have to enable any macros or add any paths to the project? 

    void set_current_time(time_t current_time)
    {
    ctime(&current_time);

    struct tm ts = *localtime(&current_time);
    rtc_t time_to_rtc = {.sec = RTC_ByteToBcd2(ts.tm_sec),
    .min = RTC_ByteToBcd2(ts.tm_min),
    .hour = RTC_ByteToBcd2(ts.tm_hour),
    .days = RTC_ByteToBcd2(ts.tm_mday),
    .weekDay = RTC_ByteToBcd2(ts.tm_wday),
    .month = RTC_ByteToBcd2(ts.tm_mon + 1),
    .year = RTC_ByteToBcd2(ts.tm_year - BASE_YEAR)};

    set_time(&time_to_rtc);
    }

  • Those API are working quite fine on my end with the nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\experimental\ble_app_cgms example.

    FreeRTOS should not have any role in this behavior except the stack sizes I mentioned before. So I am not sure what causes the issue you are seeing.

  • The issue got resolved.

    I have added -rtos GDBServer\RTOSPlugin_FreeRTOS this to my debugger settings for debugging crashes between threads, after removing this the issue got resolved. i am not sure how does that plugin affects those time.h api's.

Related