使用 AVR-Ada 执行任务

发布于 2024-12-11 09:26:25 字数 1475 浏览 1 评论 0 原文

我正在尝试使用 AVR-Ada 实现任务功能,但是当我运行 make 时,我收到以下错误消息:

C:\avr_test>make
avr-gcc.exe (GCC) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ADA_PROJECT_PATH= avr-gnatmake -XMCU=atmega8 -p -Pbuild.gpr  -XAVRADA_MAIN=led_on avr-gcc -c --RTS=rts/avr4 -gnatec=C:\avr-ada\lib\gnat\gnat.adc -gdwarf-2 -gnatwp -gnatwu gnatn -gnatp -gnatVn -Os -gnatef -fverbose-asm -frename-registers -mmcu=atmega8 gnateDMCU=atmega8 -fdata-sections -ffunction-sections -I- -gnatA C:\avr_test\led_on.adb
c:\avr_test\led_on.adb:3:06: warning: unit "task_bla" is not referenced
c:\avr_test\task_bla.ads:3:04: construct not allowed in configurable run-time mode
c:\avr_test\task_bla.ads:3:04: violation of restriction "no_tasking" at C:\avr-ada\lib    \gnat\gnat.adc:124
avr-gnatmake: "c:\avr_test\led_on.adb" compilation error
make: ** [led_on.elf] Erro 4

那么,我该怎么做才能启用任务功能?

我的包只有非常简单的测试任务:(我只是想检查任务功能)

-- led_on.adb
with AVR; use AVR;
with AVR.MCU;
with task_bla;
procedure LED_On is
 LED : Boolean renames MCU.PortB_Bits (3);
begin
 MCU.DDRB_Bits := (others => DD_Output);
 LED := Low;
end LED_On;

-- task_bla.ads
package task_bla is
 task test;
end task_bla;

-- task_bla.adb
package task_bla is
 task body test is
  loop
   null;
  end loop;
 end test;
end task_bla;

I'm trying to implement tasking features using AVR-Ada, but when I run make, I get these error messages:

C:\avr_test>make
avr-gcc.exe (GCC) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ADA_PROJECT_PATH= avr-gnatmake -XMCU=atmega8 -p -Pbuild.gpr  -XAVRADA_MAIN=led_on avr-gcc -c --RTS=rts/avr4 -gnatec=C:\avr-ada\lib\gnat\gnat.adc -gdwarf-2 -gnatwp -gnatwu gnatn -gnatp -gnatVn -Os -gnatef -fverbose-asm -frename-registers -mmcu=atmega8 gnateDMCU=atmega8 -fdata-sections -ffunction-sections -I- -gnatA C:\avr_test\led_on.adb
c:\avr_test\led_on.adb:3:06: warning: unit "task_bla" is not referenced
c:\avr_test\task_bla.ads:3:04: construct not allowed in configurable run-time mode
c:\avr_test\task_bla.ads:3:04: violation of restriction "no_tasking" at C:\avr-ada\lib    \gnat\gnat.adc:124
avr-gnatmake: "c:\avr_test\led_on.adb" compilation error
make: ** [led_on.elf] Erro 4

So, what can I do to enable the tasking features?

My package has just very simple test task: (I just wanted to check the task feature)

-- led_on.adb
with AVR; use AVR;
with AVR.MCU;
with task_bla;
procedure LED_On is
 LED : Boolean renames MCU.PortB_Bits (3);
begin
 MCU.DDRB_Bits := (others => DD_Output);
 LED := Low;
end LED_On;

-- task_bla.ads
package task_bla is
 task test;
end task_bla;

-- task_bla.adb
package task_bla is
 task body test is
  loop
   null;
  end loop;
 end test;
end task_bla;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

成熟的代价 2024-12-18 09:26:25

您必须为 AVR-Ada 的运行时系统实施任务。

我认为硬件不能很好地支持任务,所以这可能相当困难。

You would have to implement Tasking for the Runtime System of AVR-Ada.

I don't think the hardware supports tasking well, so this might be quite difficult.

迷路的信 2024-12-18 09:26:25

在不了解 AVR 的情况下,您的 gnat.adc 文件中的第 124 行似乎有 no_tasking 限制,请查看此内容,看看是否可以安全地删除它。

注意:这可能是有充分理由的,所以这样做的风险由您自己承担。

Without knowing about AVR it looks like there is a no_tasking restriction in your gnat.adc file, at line 124, have a look at this and see if you can remove it safely.

NOTE: This was probably put in for a GOOD reason, so do so at your own risk.

一束光,穿透我孤独的魂 2024-12-18 09:26:25

我找到了可能是这件事的线索。我正在更详细地阅读 AVR-Ada 文档,我在 AVR-Ada Sourceforge 文档 Status 区域中找到了这一点-ada/index.php?title=状态" rel="nofollow">http://sourceforge.net/apps/mediawiki/avr-ada/index.php?title=状态

AVR-Ada当前是基于gcc-4.3.3的V1.1。

所提供的 Ada 运行时系统 (RTS) 在很大程度上甚至不是运行时系统。它更像是一个编译时系统:-)。 RTS 中的大多数文件仅在编译时需要。因此,我们还不支持异常或任务(多线程)。

有一些 AVR 特定支持。类型和接口定义、定时例程、eeprom 访问、UART,以及最重要的是大多数 AVR 部件所需的端口和中断定义。

因此,任务分配功能一开始并未启用/可用。深入文档,我在 http://sourceforge .net/apps/mediawiki/avr-ada/index.php?title=InstallRunTimeSystem

安装运行时系统

安装 Ada 运行时系统和 AVR 支持库

构建并安装 Ada 交叉编译器后,您需要一个基本的运行时系统 (RTS)。

解压AVR-Ada源代码发行版后,在顶级目录中运行configure和make。配置从已安装的 gcc 确定安装路径 (PREFIX)。请参阅 Makefile 中不同 make 目标的注释。您应该首先构建并安装 RTS,然后是 AVR 库。 RTS 将安装在 gcc 树中,AVR 库将安装在 PREFIX/avr/ada 中。确保您在这些位置具有写入权限。

<前><代码>配置
制作build_rts
进行安装_rts
制作构建库
制作安装库

仅存在运行时库中的几个文件。目前它仅包含编译时所需的文件。请参阅目录 rts/adainclude。

AVR-Ada 的未来版本应该扩展所提供的 RTS 的可能性。这可能包括:

艾达例外。 AVR-libc 中已经支持 setjmp/longjmp,但我不知道异常在嵌入式系统中有多有用。
简单的任务(就像在Ravenscar 简介中一样)。这可能应该构建在像 AvrX 这样的小型调度程序之上。

不要指望在不久的将来会出现任何事情!

好吧,我还没有时间测试这一切。但很快我就会做到了。也许需要付出一点努力才能启用任务分配。

I've found what maybe can be a clue for this. I was reading the AVR-Ada documentation in more detail, and I found this in Status area of AVR-Ada Sourceforge documentation http://sourceforge.net/apps/mediawiki/avr-ada/index.php?title=Status:

The current of AVR-Ada is V1.1 based on gcc-4.3.3.

The provided Ada run time system (RTS) is for the most part not even a run time system. It is more a compile time system :-). Most files in the RTS are only needed at compile time. As a consequence we don't yet have support for exceptions nor for tasking (multi-threading).

There is some AVR specific support. Type and interface definitions, timing routines, eeprom access, UART, and most importantly the necessary port and interrupt definitions for most AVR parts.

So, the tasking feature is not enabled/available at first. Going deeper in the documentation, I found this in http://sourceforge.net/apps/mediawiki/avr-ada/index.php?title=InstallRunTimeSystem:

InstallRunTimeSystem

Install the Ada Run Time System and AVR Support Libraries

After building and installing the Ada cross compiler you need a basic run time system (RTS).

After unpacking the AVR-Ada source distribution, run configure and make in the top level directory. Configure determines the installation path (PREFIX) from the installed gcc. See the comments in the Makefile for the different make targets. You should first build and install the RTS, then the AVR libraries. The RTS will be installed in the gcc tree, the AVR libraries will be installed in PREFIX/avr/ada. Make sure that you have write permissions in these locations.

configure
make build_rts
make install_rts
make build_libs
make install_libs

Only a few files from the run time library exist. For the time being it consists only of files that are needed at compile time. See the directory rts/adainclude.

Future versions of AVR-Ada should extend the possibilities of the provided RTS. This might include:

Ada exceptions. There is already support for setjmp/longjmp in AVR-libc, but I don't know how useful are exceptions in embedded systems.
Simple tasking (like in the Ravenscar profile). This should probably be built on top of a small scheduler like AvrX.

Don't count on anything appearing in the near future!

Well, I did not have time yet to test all this. But soon I shall have done it. And maybe a little effort will be necessary to make tasking enabled.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文