Tasking with AVR-Ada

1.4k views Asked by At

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;
3

There are 3 answers

0
Rego On BEST ANSWER

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.

0
Rommudoh On

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.

0
NWS On

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.