rpi4-osdev/part10-multicore
2021-02-21 21:47:59 +00:00
..
audio.bin Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
audio.wav Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
boot.h Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
boot.S Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
fb.c Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
fb.h Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
io.c Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
io.h Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
kernel.c Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
link.ld Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
Makefile Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
Makefile.gcc Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
mb.c Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
mb.h Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
multicore.c Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00
multicore.h A few short changes to the write-up 2021-02-21 21:47:59 +00:00
README.md A few short changes to the write-up 2021-02-21 21:47:59 +00:00
terminal.h Added part10-multicore - a rough multicore approach to sound 2021-02-21 20:58:04 +00:00

Writing a "bare metal" operating system for Raspberry Pi 4 (Part 10)

Using multiple CPU cores

Instead of a background DMA transfer, I suggested that we might use a second CPU core to play the audio whilst our main core continues on. I also said it would be hard on the Raspberry Pi 4... and it is.

I wrote this code as I referenced Sergey Matyukevich's work, for which I am very grateful. It did need some modification to ensure the secondary cores are woken up when the time is right. This code isn't particularly "safe" yet, but it's good enough to prove the concept in principle.

Importantly, you'll need to modify your config.txt file on your SD card to include the following lines:

kernel_old=1
disable_commandline_tags=1
arm_64bit=1

For now, I'll signpost the following points of interest in the code:

  • The new boot.S loader and related boot.h header
  • The new multicore.c library and related multicore.h header
  • A slimmed down io.h and kernel.c (DMA sound removed), with a new multicore approach to main()
  • A revised link.ld adding provisions for the secondary core's stack and the 0x00000 entry point (a result of setting kernel_old=1

I will write more soon to attempt to explain what's going on here.