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

static_assert failed due to requirement 'sizeof(timer_node_t) == 32' "unspecified message"

Hi,

I'm trying to use timers 1, 2 and 3 in my application which also uses the app_timer. It works fine when I'm just use 1 & 2 but after inserting the following code to use the third timer I'm getting an error:

const nrf_drv_timer_t m_timer = NRF_DRV_TIMER_INSTANCE(3);

This throws the error: static_assert failed due to requirement 'sizeof(timer_node_t) == 32' "unspecified message"

All the timers are enabled in sdk_cfg.h (NRFX_TIMERx_ENABLED and TIMERx_ENABLED).

The error source is this line of code in app_timer.c:

STATIC_ASSERT(sizeof(timer_node_t) == APP_TIMER_NODE_SIZE);

I have changed the value from APP_TIMER_NODE_SIZE in app_timer.h from 32 to 40 or 64. Then I'm getting another error: static assertion failed: "unspecified message".

The error source is the same line in app_timer.c as above:

STATIC_ASSERT(sizeof(timer_node_t) == APP_TIMER_NODE_SIZE);

My questions is how can I use more than two timers?

Thanks,
Roger

Parents
  • Hi Roger,

    There is no dependency between the TIMER drivers and the app_timer (which use an RTC), so this seems strange unless you also changed some configuration in your toolchain at the same time? The assert checking APP_TIMER_NODE_SIZE essentially just checks the size of the timer_node_t struct in the app_timer implementation. It can change in some caes, as described here for instance, but I do not see a link with a TIMER peripheral. Can you share your code that reproduces this? Which SDK version do you use?

    Einar

  • Hi Einar,

    I haven't changed anything in the toolchain (at least not on purpose). I'm using SDK nRF5SDK1702d674dde with Segger SES V5.40c. As mentioned compiling is still successful if I remove the code for the third timer.

    How can I share my code non public with you?

    Roger

  • Hi Einar,

    I have just noticed a strange behavior of SES: It only notices changes in the source files after a restart of SES. Very strange?!

    Roger

  • Hi Roger,

    Neuer said:
    I have just noticed a strange behavior of SES: It only notices changes in the source files after a restart of SES. Very strange?!

    Yes, that is strange. I have not experienced that before. The same with the issue that the size of the timer_node_t suddenly changes without you making any code changes that are directly related to it. I have not been able to find any similar reports, but it may be worth asking Segger about it.

    Do you see the same issues if you use SES 4.50, which is the version that was used for release testing SDK 17.0.2?

    As a side note, while it would be good to know what is going on, you should not get the app_timer issue if you switch to app_timer2.c, which is anyway the preferred implementation in SDK 17.0.2 (it was experimental for a few released before that).

    Einar

Reply
  • Hi Roger,

    Neuer said:
    I have just noticed a strange behavior of SES: It only notices changes in the source files after a restart of SES. Very strange?!

    Yes, that is strange. I have not experienced that before. The same with the issue that the size of the timer_node_t suddenly changes without you making any code changes that are directly related to it. I have not been able to find any similar reports, but it may be worth asking Segger about it.

    Do you see the same issues if you use SES 4.50, which is the version that was used for release testing SDK 17.0.2?

    As a side note, while it would be good to know what is going on, you should not get the app_timer issue if you switch to app_timer2.c, which is anyway the preferred implementation in SDK 17.0.2 (it was experimental for a few released before that).

    Einar

Children
Related