RTEMS | bsp/arm/tms570: Fix ESM IOFFHR channel off-by-one bug in bsp_reset (!1272)

Avi Weiss (@thnkslprpt) gitlab at rtems.org
Fri May 29 08:05:04 UTC 2026



Avi Weiss created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1272

Project:Branches: thnkslprpt/rtems:fix-5594-ESM-channel-0-bug-fix to rtems/rtos/rtems:main
Author:   Avi Weiss



## Summary

Fixes #5594 

Only enter the if block to clear the channel when `IOFFHR != 0`.  
This is to avoid trying to clear ESM channel `UINT32_MAX`, and then skipping channel 0 (see issue for more detail).  
Then subtract 1 inside there to get the correct channel (e.g. `IOFFHR == 1` maps to channel `0`).  

Follow-on commits just do some minor file clean-up - no logic changes (adding `U` suffix and formatting for consistency).  

Test probe (used in the issue as well) now shows expected behavior:  
```text
raw=0: 0x00000000
raw=0: DID NOT enter if (esm_irq_offset != 0U)

raw=1: 0x00000001
raw=1: *** INSIDE THE "if (esm_irq_offset != 0U)" BLOCK ***
raw=1: channel=(raw-1)=0 / 0x00000000
handle_esm_errors: clearing SR[0] bit 0, mask=0x00000001

raw=2: 0x00000002
raw=2: *** INSIDE THE "if (esm_irq_offset != 0U)" BLOCK ***
raw=2: channel=(raw-1)=1 / 0x00000001
handle_esm_errors: clearing SR[0] bit 1, mask=0x00000002
```


<!-- Default settings, if it is a dropdown it will set after submission -->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1272
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260529/77de5509/attachment.htm>


More information about the bugs mailing list