RTEMS | BSP Improvements for RPi4 (&6)

Ning Yang (@yangn0) gitlab at rtems.org
Fri Jul 5 03:57:33 UTC 2024




Ning Yang commented: https://gitlab.rtems.org/groups/rtems/-/epics/6#note_108687


Coding Period Week #1
1. found RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT fatal of a72_lp64_qemu BSP related to clock interrupt. https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/29
2. found a termios bug. scanf()/read() is not blocking in UART interrupt mode. https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5012

Next week:
1. continue to test the new pl011 driver and assist @Barusu  in merging it.
2. test Mailbox driver.

Coding Period Week #2
1. Made a MR to add new pl011 driver. https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/43
2. Wrote a blog about RPi4 BSP
 system timer porting. https://yangn0.github.io/2024/05/22/RTEMS-RPi4B-BSP-add-system-timer-driver-support.html
3. Try to understand RPi's mailbox peripheral workflow and Barusu's mailbox driver code.
next week:
1. test mailbox driver
2. read SPI related content and prepare to start writing SPI driver

Coding Period Week #3
Planned:
1. test mailbox driver
2. read SPI related content and prepare to start writing SPI driver

Completed:
1. Read the mailbox related content. The blog written by Utkarsh last year was of great help.
https://bitbanged.com/posts/understanding-rpi/the-mailbox/
2. Read SPI related content:
- I compared the SPI part of the bcm2711 and bcm2835 data sheets, and they are almost identical. The `arm/raspberrypi` BSP supports SPI, but it does not use the linux-based framework. I need to rewrite it, but it's still useful as a reference.
- `shared/dev/spi/spi-gpio.c` Christian's recent commit seems like a good pattern.
3. Refactor pl011 driver and versal uart driver, https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/47/commits
4. bsps/xilinx-versal: fix BSP_INTERRUPT_VECTOR_COUNT too large https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/51

Blockers/Problems:
1. What should I do next about the pl011 driver?
2. I'm trying to test Utkarsh's mailbox driver. It would be great if there are examples of mailbox driver usage. The sdhci driver may need mailbox support. I'll figure it out before sdhci starts.

Next week plans:
1. Refactor pl011 driver.
2. Start writing SPI driver.

Coding Period Week #4
Planned:
1. Refactor pl011 driver.
2. Start writing SPI driver.

Completed:
1. Reorganized the pl011 driver
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/47
2.  Requested to merge gpio driver
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/59
3. Wrote part of spi_transfer
https://gitlab.rtems.org/yangn0/rtems/-/commits/SPI/

Blockers/Problems:
- I plan to complete spi driver first with polling mode. I read Atmel SAM SPI driver, NXP i.MX SPI driver and NXP LPC17XX/LPC24XX/LPC40XX SSP driver. They seem to use interrupt mode or dma mode. Should I implement interrupt mode SPI directly?

Next week plans:
1. Try SPI bare metal program of RPi4. https://github.com/babbleberry/rpi4-osdev/blob/master/part14-spi-ethernet/lib/spi.c
2. Continue to complete spi_transfer
3. Refactor pl011 driver

Coding Period Week #5
Planned:
1. Try SPI bare metal program of RPi4. https://github.com/babbleberry/rpi4-osdev/blob/master/part14-spi-ethernet/lib/spi.c
2. Continue to complete spi_transfer
3. Refactor pl011 driver

Completed:
1. Successfully ran the SPI bare metal program and captured the output with a logic analyzer.

2. Wrote part of spi_transfer()
https://gitlab.rtems.org/yangn0/rtems/-/commits/SPI/

3. Modified pl011 MR based on comments https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/47

4. dev/pl011: Fix incorrect macro definition https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/64

Blockers/Problems:
None

Next week plans:
1. Continue to complete spi_transfer
2. Refactor pl011 driver

Coding Period Week #6
Planned:
1. Continue to complete spi_transfer
2. Refactor pl011 driver

Completed:
1. I completed code writing of the standard SPI master mode. only polling mode and SPI0.
It doesn't work properly yet and needs debugging.
https://gitlab.rtems.org/yangn0/rtems/-/compare/main...SPI?from_project_id=26

2. Improved MR: dev/serial: Refactor the pl011 driver to be extensible
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/47

3. Improved MR: aarch64/raspberrypi: Add gpio driver
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/59

Blockers/Problems:
None.

Next week plans:
1. Debug spi driver and write other parts.
2. Improve MR.

Coding Period Week #7
Planned:
1. Debug spi driver and write other parts.
2. Improve MR.

Completed:
1. Merged MR: aarch64/raspberrypi: Add gpio driver
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/59

2. Merged MR: raspberrypi4.rst: Documation for the gpio driver
https://gitlab.rtems.org/rtems/docs/rtems-docs/-/merge_requests/18

3. SPI driver now works fine. It currently only supports the standard SPI master mode, only polling mode and SPI0. I tested it with a logic analyzer and it outputs fine.
https://gitlab.rtems.org/yangn0/rtems/-/compare/main...SPI?from_project_id=26

Blockers/Problems:
1. I am writing SSD1306 driver to display a RTEMS logo and encountered some problems, but I think I can solve them.
https://github.com/yangn0/RTEMS_app/commit/e422f6d50f84d5282ac7265919f1276fcc4453a6

2. PL011 MR: The current blocker is that the new pl011 driver needs to be tested on a versal hardware.
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/47#note_107457

Next week plans:
1. Debug SSD1306 driver and implement SPI interrupt mode.
2. improve PL011 MR.

Coding Period Week #8
Planned:
1. Debug SSD1306 driver and implement SPI interrupt mode.
2. improve PL011 MR.

Completed:
1. The SPI driver now works fine on SPI0 but not SPI3-6. 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/103

2. The SSD1306 driver has also been completed.
https://github.com/yangn0/RTEMS_app/blob/main/test/test.c
https://www.youtube.com/watch?v=DFtzoiYVMiQ

3. Wrote part of spi interrupt mode.
https://gitlab.rtems.org/yangn0/rtems/-/tree/SPI-irq

4. Improve PL011 MR: Split the versul uart part from MR
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/47#note_108648

Blockers/Problems:
SPI3-6 cant work. I suspect there is some undocumented configuration for SPI3-6 and I've asked the Raspberry Pi forum for help.
https://forums.raspberrypi.com/viewtopic.php?p=2233312#p2233312

Next week plans:
1. SPI interrupt mode.
2. Improve PL011 MR.

-- 
View it on GitLab: https://gitlab.rtems.org/groups/rtems/-/epics/6#note_108687
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/20240705/c627f919/attachment-0001.htm>


More information about the bugs mailing list