app event manager section placement sort issue

2100.app_event_manager_issue.zip

Hello,

I hope you are having a nice day. I recently updated from ncs v1.6.1 to v2.2.0. My application is based on the "Application Event Manager" module. I have found that section placement of the event subscribers is being sorted alphabetically by the linker. This has the side effect of potentially having subscriber sections interspersed if there happens to be overlap in the event names. For example, say an application has two events ("event_rx", and "event_rx_error"). The zephyr.map will be generated with sections in the following order:

event_subscribers_event_rx_a
event_subscribers_event_rx_error_a   --------------------> WHOOPS!
event_subscribers_event_rx_error_p10
event_subscribers_event_rx_error_z
event_subscribers_event_rx_p10
event_subscribers_event_rx_z

As noted, these sections are listed alphabetically, but the Application Event Manager logic does not handle interspersed subscriber sections.

I have attached an example using the application event manager reference example. In the example, I changed the "control_event" to "measurement_event_control_event". I added a text file containing how the zephyr.map file ends up not laid out properly. In the reference material, nordic (by convention) ends their events with "_event". Following this practice can mitigate the section placement issue to a degree, but if the name of one event overlaps with the name of another event, this section placement issue can still occur. 

Is there a way to explicitly eliminate this section placement issue? 

(aside from manually enforcing naming convention rules)

Additionally, I noticed on ncs v2.2.0 while debugging event listeners (an activity which blocks the system work queue) zephyr timer callbacks (in my case running every 10ms) that create events will hit event allocation failure. Is this mitigatable, perhaps by instead using delayed work items instead of timer callbacks? What is best practice here?

Thank you very much for your time!

  • Hello, 

    I will need to discuss with our team responsible for the Application Event Manager module.

    Kind regards,
    Øyvind

  • Hello, I've forwarded the issue to the developers. They will look into this. Have you tried to reproduce in a clean sample from nRF Connect SDK v2.2.0 i.e. not updated from v1.6.0?

    -Øyvind

  • Hello. Thank you for the response.

    Yes, the example I provided was the sample from v2.2.0 (with an event name changed). The v1.6.0 event_manager sample does not have the section placement issue. Here is a sample from the v1.6.0 event_manager sample map file, with a modified event name.event_manager.zip

    event_subscribers_measurement_event_zcontrol_event_prio0_
                    0x0000bb24        0x0
     event_subscribers_measurement_event_zcontrol_event_prio0_
                    0x0000bb24        0x0 app/libapp.a(measurement_event_zcontrol_event.c.obj)
    
    event_subscribers_measurement_event_zcontrol_event_prio1_
                    0x0000bb24        0x4
     event_subscribers_measurement_event_zcontrol_event_prio1_
                    0x0000bb24        0x0 app/libapp.a(measurement_event_zcontrol_event.c.obj)
                    0x0000bb24                event_subscribers_measurement_event_zcontrol_event_prio1_empty
     event_subscribers_measurement_event_zcontrol_event_prio1_
                    0x0000bb24        0x4 app/libapp.a(sensor_simulated.c.obj)
                    0x0000bb24                __event_subscriber_measurement_event_zcontrol_eventsensor_sim
    
    event_subscribers_measurement_event_zcontrol_event_prio2_
                    0x0000bb28        0x0
     event_subscribers_measurement_event_zcontrol_event_prio2_
                    0x0000bb28        0x0 app/libapp.a(measurement_event_zcontrol_event.c.obj)
    
    event_subscribers_measurement_event_prio0_
                    0x0000bb28        0x0
     event_subscribers_measurement_event_prio0_
                    0x0000bb28        0x0 app/libapp.a(measurement_event.c.obj)
    
    event_subscribers_measurement_event_prio1_
                    0x0000bb28        0x8
     event_subscribers_measurement_event_prio1_
                    0x0000bb28        0x0 app/libapp.a(measurement_event.c.obj)
                    0x0000bb28                event_subscribers_measurement_event_prio1_empty
     event_subscribers_measurement_event_prio1_
                    0x0000bb28        0x4 app/libapp.a(controller.c.obj)
                    0x0000bb28                __event_subscriber_measurement_eventcontroller
     event_subscribers_measurement_event_prio1_
                    0x0000bb2c        0x4 app/libapp.a(stats.c.obj)
                    0x0000bb2c                __event_subscriber_measurement_eventstats
    
    event_subscribers_measurement_event_prio2_
                    0x0000bb30        0x0
     event_subscribers_measurement_event_prio2_
                    0x0000bb30        0x0 app/libapp.a(measurement_event.c.obj)
    
    

  • Thanks for providing more information. The developers have informed me that they will look into this, however, they are not sure on the timeline. 

Related