That solved the problem of the initialization of the secondary stack. Now it crashes at the elaboration of Ada.Real_Time:
Starting program: /home/re/Devel/rp2040/rp2040_snippets/blink_light_tasking/bin/blink_light_tasking
Breakpoint 1, 0x10002e40 in __gnat_last_chance_handler ()
(gdb) bt
#0 0x10002e40 in __gnat_last_chance_handler ()
#1 0x100013f8 in system.bb.board_support.time.install_alarm_handler ()
#2 0x10001c7c in system.bb.time.initialize_timers ()
#3 0x10002a6e in system.bb.threads.initialize ()
#4 0x10002828 in system.tasking.initialize ()
#5 0x10001352 in ada__real_time___elabb ()
#6 0x100001fe in adainit () at b__blink_light_tasking.adb:38
#7 0x10000284 in main () at b__blink_light_tasking.adb:60
#8 0x100032a8 in _start_rom ()
It seems to me that there is some basic problem somewhere that I donāt see
(using gnat_arm_elf 14.2.1, gprbuild 25.0.1, alr 2.1.0 on Debian Trixie)
I could solve the mentioned elaboration issues by pragma Elaborate_All (Tasks); in the main program.
It now does not return from Tasks'Elab_Body;. I suppose that is where the tasks are actually started.
Glad the secondary stack workaround worked for you.
Iām not sure why Install_Alarm_Handler is raising an exception, or why Elaborate_All fixes it. Very confusing. Do you have a traceback for when it gets stuck in TasksāElab_Body? Is it another exception?
Iāve got another Pico on order so I can start to investigate these issues on my end. I suspect that some things have changed since I did the original port 4 years ago which may have broken things, and theyāre only being found now.
As a shot in the dark you could give the more recent gnat_arm_elf 15.1.2 a try and see if that improves the situation.
Also, the embedded-rpi-pico-smp runtime enables exception propagation which might allow the runtime to capture more information about the exception. You could enable semihosting in your debugger and see if any messages get printed there from the last chance handler (the runtime uses semihosting for Ada.Text_IO).
So Iāve received my new Pico and have tried to reproduce the problems youāve been having, but Iāve not had any luck; I have not been able to reproduce the same problems youāve been seeing with the tasking runtime.
I created a demo project which uses light-tasking-rpi-pico-smp runtime to blink the LED using two tasks (one on each core), and it compiles and runs successfully without any issues.
Thank you very much for all your efforts and patience.
No, it does not work for me. I can compile and upload cleanly. I can single step through the main program in the debugger. Watching blinky.blink_control.current_status always shows a false value.
OK, that was a typo! Changing the procedure Toggle to Current_Status := not Current_Status; makes it work!