Hi, I am using a forked git copy of 3.0.0 and have NIL-periodic, NIL-freerunning, and RT-periodic working.
But, it looks like RT-freerunning is missing the necessary ports/AVR/chcore (chcore_timer) functions to communicate with HAL timer functions.
Is anyone working on this? do they need help? ...or is it still waiting to be started?
If no one has started, I can get started myself, and publish what I have to GIthub.
Please let me know the status of RT-freerunning, and what I may do to help.
Thank you. Rick.
AVR tick-less (freerunning) for RT
-
- Posts: 359
- Joined: Sat Jan 07, 2012 6:22 pm
- Location: Brazil
- Has thanked: 1 time
- Been thanked: 20 times
- Contact:
Re: AVR tick-less (freerunning) for RT
I had tested all of these options and all seemed to work. I'll recheck if some recent change has broken anything.
Cheers,
Fabio Utzig
Cheers,
Fabio Utzig
-
- Posts: 359
- Joined: Sat Jan 07, 2012 6:22 pm
- Location: Brazil
- Has thanked: 1 time
- Been thanked: 20 times
- Contact:
Re: AVR tick-less (freerunning) for RT
Rick, you are right. There was some code missing. I already have a patch ready but I'm not able to test it myself because I don't have any AVR powered boards here. Can you test it and confirm it works?
Re: AVR tick-less (freerunning) for RT
Hi, yes I can do some testing. Just let me know how to get the patch.
I'm currently forking from the primary Github location.
Thanks. Rick.
I'm currently forking from the primary Github location.
Thanks. Rick.
-
- Posts: 359
- Joined: Sat Jan 07, 2012 6:22 pm
- Location: Brazil
- Has thanked: 1 time
- Been thanked: 20 times
- Contact:
Re: AVR tick-less (freerunning) for RT
Hi Rick, I was confident enough that it should work that I already commited the changes to SVN! The github mirror should be updated soon.
The patch is here: https://gist.github.com/utzig/52213b644be8ffb27077
Cheers,
Fabio Utzig
The patch is here: https://gist.github.com/utzig/52213b644be8ffb27077
Cheers,
Fabio Utzig
Re: AVR tick-less (freerunning) for RT
Thank you. I'll use that. It may take a day or two while I work on this.
Then I'll report back and let you know how everything is.
Thanks. Rick.
Then I'll report back and let you know how everything is.
Thanks. Rick.
-
- Posts: 359
- Joined: Sat Jan 07, 2012 6:22 pm
- Location: Brazil
- Has thanked: 1 time
- Been thanked: 20 times
- Contact:
Re: AVR tick-less (freerunning) for RT
Hi,
Just go my Arduino back and tested RT with freerunning. Seems to be working!
Cheers,
Fabio Utzig
Just go my Arduino back and tested RT with freerunning. Seems to be working!
Cheers,
Fabio Utzig
Re: AVR tick-less (freerunning) for RT
Hi,
Yes, I have it working also. All the tests reported success to the serial port.
I am using an Arduino MEGA2560 board (I changed MCU = atmega2560 in the Makefile) and the build gives the following warning:
This is caused by trying to shift the function pointer by 16. This is not needed. pcx should be set to zero.
i.e. change
to
All function addresses created by the avr compiler are 16 bit.
If the function ends up being linked above 128 KiB a trampoline is used, this ends up as two jumps instead on one, a little extra time, but that is the price to pay for a HUGE program. The linker takes care of all this.
EXCEPT, there is a problem with the linker. (see: https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html the section 3.17.5.1 EIND and Devices with More Than 128 Ki Bytes of Flash)
so the following should be added to the appropriate sections in the Makefile when using atmega2560 or any other mcu with >128 KiB flash:
This is the theory anyway. I have not created a program with function in very high memory, that may be something I'll try next weekend.
Rick.
Yes, I have it working also. All the tests reported success to the serial port.
I am using an Arduino MEGA2560 board (I changed MCU = atmega2560 in the Makefile) and the build gives the following warning:
Code: Select all
Compiling C: ../../../os/rt/src/chthreads.c
avr-gcc -c -mmcu=atmega2560 -I. -gdwarf-2 -DF_CPU=16000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./../../../os/rt/src/chthreads.lst -I../../../os/rt/ports/AVR -I../../../os/rt/ports/AVR/compilers/GCC -I../../../os/rt/include -I../../../test/rt -I../../../os/hal/include -I../../../os/hal/osal/rt -I../../../os/hal/ports/AVR -I../../../os/hal/boards/ARDUINO_MEGA -I../../../os/various -std=gnu11 -mrelax -Wundef -MMD -MP -MF .dep/chthreads.o.d ../../../os/rt/src/chthreads.c -o ../../../os/rt/src/chthreads.o
In file included from ../../../os/rt/include/ch.h:74:0,
from ../../../os/rt/src/chthreads.c:55:
../../../os/rt/src/chthreads.c: In function ‘chThdCreateI’:
../../../os/rt/ports/AVR/chcore.h:162:49: warning: right shift count >= width of type [enabled by default]
sizeof(struct port_intctx)); \
^
../../../os/rt/src/chthreads.c:187:3: note: in expansion of macro ‘PORT_SETUP_CONTEXT’
PORT_SETUP_CONTEXT(tp, wsp, size, pf, arg);
^
This is caused by trying to shift the function pointer by 16. This is not needed. pcx should be set to zero.
i.e. change
Code: Select all
tp->p_ctx.sp->pcx = (int)_port_thread_start >> 16; \
to
Code: Select all
tp->p_ctx.sp->pcx = 0; \
All function addresses created by the avr compiler are 16 bit.
If the function ends up being linked above 128 KiB a trampoline is used, this ends up as two jumps instead on one, a little extra time, but that is the price to pay for a HUGE program. The linker takes care of all this.
EXCEPT, there is a problem with the linker. (see: https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html the section 3.17.5.1 EIND and Devices with More Than 128 Ki Bytes of Flash)
so the following should be added to the appropriate sections in the Makefile when using atmega2560 or any other mcu with >128 KiB flash:
Code: Select all
CFLAGS += -mrelax
CPPFLAGS += -mrelax
This is the theory anyway. I have not created a program with function in very high memory, that may be something I'll try next weekend.
Rick.
- Giovanni
- Site Admin
- Posts: 14458
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: AVR tick-less (freerunning) for RT
Hi Fabio,
Could you add all the changes to the readme.txt? it is required for the release note.
When SourceForge starts working again of course...
Giovanni
Could you add all the changes to the readme.txt? it is required for the release note.
When SourceForge starts working again of course...
Giovanni
-
- Posts: 359
- Joined: Sat Jan 07, 2012 6:22 pm
- Location: Brazil
- Has thanked: 1 time
- Been thanked: 20 times
- Contact:
Re: AVR tick-less (freerunning) for RT
As soon as SVN is back I'll change pcx and add -mrelax.
You should also read my latest post on the previous ATmega2560 thread:
viewtopic.php?f=21&t=2642#p21203
What do you think?
Will do.
Cheers,
Fabio Utzig
You should also read my latest post on the previous ATmega2560 thread:
viewtopic.php?f=21&t=2642#p21203
What do you think?
Giovanni wrote:Could you add all the changes to the readme.txt? it is required for the release note.
Will do.
Cheers,
Fabio Utzig
Who is online
Users browsing this forum: No registered users and 2 guests