Catalin Miron created a merge request: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1518

Project:Branches: catalin/rtems:stm32f4_bsp_fix to rtems/rtos/rtems:main
Author: Catalin Miron

## Summary

BSP_output_char used Console_Port_Tbl, which is only allocated by the legacy 
console_initialization(). With the simple console driver (e.g 
testsuites/samples/hello) or for any printk() before device driver 
initialization this resulted in a NULL pointer dereference. The USART was also 
never initialized in this case.

Fall back to Console_Configuration_Ports while Console_Port_Tbl is not yet set 
up. Initialize the console USART in a BSP_START system initialization handler 
and laizly on the first character. Provide BSP_poll_char for getchark().

Disabled STM32F4_ENABLE_USART_3 by default because not all stm32f4 boards have 
this port. Added PORT_COUNT \> 0 guards in case no USART is configured in 
config.ini.

Tested on STM32F411RE Nucleo board by running hello.exe

## AI Details

<!--Make sure you have read our statement at 
https://www.rtems.org/generative-ai/-->

### Prompt used

Not a single prompt, it was an iterative process.

### AI model used

Claude Opus 5.5

### How AI was used for the contribution

- [x] Formatting
- [ ] Test creation.
- [x] Code comments.
- [ ] The entire contribution was generated using AI
- [ ] AI code completion such as Copilot in VSCode.

If others were used please add below

The source of the crash was found by me with gdb, then I asked Calude for a 
fix, then I suggested changes to that solution.

### Access

I have not used a product which claims copyright in its output, and I have 
legitimate access to the one I used.

<!--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/1518
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-54u2fn4i6yhth0t34u8tnzggc-1d/unsubscribe
 | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | 
Help: https://gitlab.rtems.org/help


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to