Closed damaki closed 3 years ago
One general comment about this pull request is that there is a lot of code copy pasted from various sources (like Pico SDK) with different copyright holders and I am not comfortable merging all this in our repo.
I understand your concern. The files that were adapted from the Pico SDK are:
arm/rpi/rp2040/boot2__w25q080.S
arm/rpi/rp2040/crt0.S.tmpl
arm/rpi/rp2040/memmap_copy_to_ram.ld
arm/rpi/rp2040/memmap_default.ld
arm/rpi/rp2040/memmap_no_flash.ld
The SVD files were generated from rp2040.svd
that was contributed to the svd2ada project.
All other files in this contribution were written from scratch (e.g. s-bootro.adb
), or were adapted from existing sources in bb-runtimes.
I could delete the code that was copied from the Pico SDK and replaced it with code that was adapted from other sources in bb-runtimes. For example, delete crt0.S.tmpl
and replace it with an implementation adapted from arm/stm32/stm32f0xx/start-rom.S
, and similarly for the memory maps.
The only remainining file would be boot2__w25q080.S
which was pre-compiled from Pico SDK. I can look into replacing this with a pure Ada implementation.
Would that be acceptable to you?
One general comment about this pull request is that there is a lot of code copy pasted from various sources (like Pico SDK) with different copyright holders and I am not comfortable merging all this in our repo.
In commit db35c4c I've removed the startup code and linker scripts that were copied from the Pico SDK (i.e. the crt0.S.tmpl
and memmap_*.ld
files) and have replaced them with files that were adapted from existing sources in bb-runtimes (from the STM32 runtimes).
The only thing that still remains from Pico SDK is the precompiled bootloader (boot2__w25q080.S
). I did some experiments trying to write a pure Ada implementation, but ran into several problems that made it quite difficult. Would you be happy to keep this file, or does it also need to be replaced?
It's worth noting that all of the code that was copied from pico-sdk is BSD-3-Clause licensed and I've made rp2040_hal, pico_bsp, and pico_examples available under the same. The boot2 code is generated by preprocessing the BSD licensed code with Debian's FSF GCC toolchain which does not impose any additional license requirements on generated artifacts.
Thanks for the update @damaki
The only thing that still remains from Pico SDK is the precompiled bootloader (
boot2__w25q080.S
). I did some experiments trying to write a pure Ada implementation, but ran into several problems that made it quite difficult.
What was the problem?
Would you be happy to keep this file, or does it also need to be replaced? Ideally having a source version would be best.
The boot2 code is generated by preprocessing the BSD licensed code with Debian's FSF GCC toolchain which does not impose any additional license requirements on generated artifacts.
It is not so much about the license, but the Contributor License Agreement.
What was the problem?
The main challenges I came across was a) fitting it all in 252 bytes, and b) lack of initialsation on entry to the bootloader. Mainly it was getting it all to fit into 252 bytes, though, given that I needed more initialisation in the pure Ada code (e.g. needed a stack pointer).
Ideally having a source version would be best.
It is not so much about the license, but the Contributor License Agreement.
Thanks for clarifying. I'll continue working on a clean implementation of the bootloader, along with associated scripts to generate the CRC etc during runtime generation.
Closing this PR as this work has since been updated & rebased to the community-2021
branch. See #55.
This adds support for the dual-core RP2040 microcontroller and the Raspberry Pi Pico board.
Support is added for Ravenscar-full and Ravenscar-sfp runtimes only. Projects on the Pico that require a ZFP runtime can use the the generic
zfp-cortex-m0p
runtime, with startup code available in thepico_bsp
crate in Alire.Two runtime variants are supported for the Pico:
rpi-pico-sp
is a single processor variant where Ada tasks and interrupts are dispatched on core0 only. core1 can be used for other purposes, for example pico-debug.rpi-pico-mp
is the multiprocessor variant where Ada tasks and interrupts can be dispatched on either core. TheCPU
attribute can be used to assign tasks to either core, allowing tasks to be executed in parallel. For example:Further details are documented in
arm/rpi/rp2040/README