This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[NCS 1.7.0] AT monitor section alignment bug

Hi,

The new AT monitor have a hard-to-reproduce bug: the subscriber entry list alignment is not specified in the linker script. Since structs are always aligned, that means that padding zeros are sometimes inserted at the beginning of the list during linking, making the whole list nonsensical and disabling AT events entirely. To fix this, specify alignment in the ld script:

diff --git a/lib/at_monitor/at_monitor.ld b/lib/at_monitor/at_monitor.ld
index a0052af70..a5793c840 100644
--- a/lib/at_monitor/at_monitor.ld
+++ b/lib/at_monitor/at_monitor.ld
@@ -1,3 +1,4 @@
+. = ALIGN(4);
 _at_monitor_entry_list_start = .;
 KEEP(*(SORT_BY_NAME("._at_monitor_entry.*")));
 _at_monitor_entry_list_end = .;

Should I open a PR at github also?

Related