Ravenscar profile/tasking on RP2040

I’m attempting to get tasking working on an RP2040 project I’m starting. According to the docs at Ada on the Raspberry Pi Pico, there were plans to get the tasking runtime included directly in the arm-eabi toolchain, and it appears that may have happened. In GNAT Studio, my runtime listing shows a “light-tasking-rpi-pico” and “light-tasking-rpi-pico-smp” runtime. Attempting to use these runtimes is giving me some linker trouble, which I’m working through, but I want to be sure that I’m putting my time toward the latest supported configuration for this use case. Does anybody know what the current situation is concerning the Ravenscar profile and tasking runtimes on the RP2040?

I’d like to thank @JeremyGrosser for all the legwork he has done on the HAL for the RP2040 – your work is hugely appreciated!

Thank you for your time,
Thomas Meier

2 Likes

I think I have a project somewhere that uses the smp runtime, I’ll see if I can get an example uploaded to GitHub. I’m traveling this week, so it may be a few days before I can do that.

From what I remember, the ravenscar runtime takes care of the linker script and boot2 code, so you can remove the package Linker section from your gpr.

If you’re using rp2040_hal drivers and the ravenscar runtime in the same project, you’ll need to set Use_Startup=false and Interrupts=bb_runtimes config variables in alire.toml. I don’t remember the exact syntax for that, so take a look at the Alire documentation.

Last time I tried the RP2040 smp runtime (I think it was called differently at that time), the linker was complaining about missing atomic operations.

Removing the linker section and setting those config variables seems to have done the trick! Thank you very much for the prompt response!

1 Like

Very polite request:
I want to do the same and paused RP2040 development for 18 months.
Do you think there is a chance you can publish the smallest example for RP2040 ravenscar which works with both kernels?
I would highly appreciate as I really could do with this…
Thanks in advance, and I respect if you cannot publish it.

See below for the gpr and alire.toml files, respectively:

with "rp2040_hal.gpr";
with "config/hello_pico_config.gpr";

project Hello_Pico is

   for Target use "arm-eabi";
   for Runtime ("ada") use "light-tasking-rpi-pico-smp";
   for Source_Dirs use ("src", "config");
   for Object_Dir use "obj/" & Hello_Pico_Config.Build_Profile;
   for Create_Missing_Dirs use "True";
   for Exec_Dir use "bin";
   for Main use ("hello_pico.adb");

   package Compiler is
      for Default_Switches ("ada") use Hello_Pico_Config.Ada_Compiler_Switches;
   end Compiler;

   package Binder is
      for Switches ("ada") use ("-Es"); --  Symbolic traceback
   end Binder;

   package Install is
      for Artifacts (".") use ("share");
   end Install;

   package Ide is
      for Connection_Tool use "openocd";
      for Connection_Config_File use "cmsis-dap_rp2040_openocd.cfg";
      for Program_Host use "localhost:3333";
      for Communication_Protocol use "extended-remote";
   end Ide;

   package Builder is
      for Switches ("ada") use ("-g", "-j8");
   end Builder;

end Hello_Pico;
name = "hello_pico"
description = "Shiny new project"
version = "0.1.0-dev"

authors = ["Your Name"]
maintainers = ["Your Name <example@example.com>"]
maintainers-logins = ["github-username"]

executables = ["hello_pico"]

[[depends-on]]
hal = "~0.3"
rp2040_hal = "^2.0"

[configuration.values]
rp2040_hal.Use_Startup = false
rp2040_hal.Interrupts = "bb_runtimes"
rp2040_hal.Flash_Chip = "w25qxx"
1 Like

Hi Thomas,
thanks a lot for this.
I am on a business trip and afterwards on holidays, I will try this when back early May.

Thanks again.

Regards,
Holger