我正在尝试在基于 Cortex M4 的板(特别是
stm32f429I
板)中进行任务分配,但看起来我正在使用的运行时不允许任务层次结构(这是有道理的)。为了提供更多背景信息,我编写了以下过程:
procedure Flash_LED_With_Randevouz is
type LED_Colour is (Red, Green);
task type LED_Controller(LC: LED_Colour) is
entry Turn_LED_On;
entry Turn_LED_Off;
end LED_Controller;
task body LED_Controller is
begin
-- Setup port clock, pin mode etc here based on "LC" value
loop
accept Turn_LED_On do
null;
end Turn_LED_On;
accept Turn_LED_Off do
null;
end Turn_LED_Off;
end loop;
end LED_Controller;
RC: LED_Controller(Red);
GC: LED_Controller(Green);
begin
null;
end Flash_LED_With_Randevouz;
(并且会有客户端任务调用这些条目)。我的
gprbuild
文件看起来像这样:
project Embedded is
for Languages use ("Ada", "Asm");
for Main use ("flash_led_with_randevouz.adb");
for Source_Dirs use ("src/**");
for Object_Dir use "obj";
for Target use "arm-eabi";
for Runtime ("Ada") use "ravenscar-full-stm32f429disco";
package Compiler is
for Default_Switches ("Ada") use ("-O0", "-g", "-gnatwa", "-gnatQ", "-gnatw.X");
end Compiler;
package Builder is
for Default_Switches ("Ada") use ("-g");
for Global_Configuration_Pragmas use "gnat.adc";
end Builder;
package Ide is
for Connection_Tool use "st-util";
for Program_Host use "localhost:4242";
for Communication_Protocol use "remote";
end Ide;
end Embedded;
当我尝试构建时,出现以下错误:
Compile
[Ada] flash_led_with_randevouz.adb
flash_led_with_randevouz.adb:5:04: warning: objects of this type will violate "No_Task_Hierarchy" [enabled by default]
flash_led_with_randevouz.adb:7:07: error: violation of implicit restriction "Max_Task_Entries = 0"
flash_led_with_randevouz.adb:18:10: error: construct not allowed in configurable run-time mode
flash_led_with_randevouz.adb:18:10: error: file s-tasren.ads not found
flash_led_with_randevouz.adb:18:10: error: entity "System.Tasking.Rendezvous.Exceptional_Complete_Rendezvous" not available
flash_led_with_randevouz.adb:28:04: error: violation of restriction "No_Task_Hierarchy"
flash_led_with_randevouz.adb:28:04: error: from profile "Jorvik" at system.ads:42
flash_led_with_randevouz.adb:29:04: error: violation of restriction "No_Task_Hierarchy"
flash_led_with_randevouz.adb:29:04: error: from profile "Jorvik" at system.ads:42
gprbuild: *** compilation phase failed
我尝试查看我的 GNAT 安装以寻找可用运行时的任何线索,并在
2021-arm-elf/arm-eabi/lib/gnat/
下发现了许多目录,我认为对应于可以在构建文件中指定的可用运行时?这些都属于两个主要类别,即 ravenscar*
和
zfp*
类别(我假设这些是支持浮点的类别?),据我所知,Ravenscar 不支持任务层次结构,我尝试了一些
zfp
的错误,但遇到了类似的错误(似乎有一些更通用的 Cortex-M4 和一些特定于板的错误)。所以,我想知道如何发现可用的运行时,以及是否有任何关于如何找到支持该板多任务处理的运行时(如果存在)的提示。 - 谢谢
<INSTALL>/share/doc/gnat-cross/html/gnat_ugx/gnat_ugx.html
中找到它。请参阅“第 4 章预定义配置文件”。 ZFP 是零足迹配置文件。它不支持任务分配。 Ravenscar 有一些任务支持,但您应该将任务移动到库级别的包中。AdaCore 最近更改了运行时名称(请参阅
文档)。使用 alire 安装 GNAT 13.2 或 GNAT 12.2 并开始使用,然后在 GNAT GPL 2021 后重新学习可能会更简单。