EmbDev.net

Forum: ARM programming with GCC/GNU tools freertos and swi_handler


von Jonathan D. (dumarjo)


Attached files:

Rate this post
useful
not useful
Hi all,

I try to make the freertos sam7x256 project sample working. I got it 
working right when I use the makefile, boot.S and atmel-rom.ld that came 
with freertos.

Now I want to use the cstartup.S, new ld files and new makefile from the 
gamma_sample.

I Have not been able to start the demo anymore. I want to use those new 
file because I would like to be able to have my vector in ram and use 
the garbage collector too.

So now, I'm a little bit lost. I attached the files That I have modified 
to get the freertos demo working.

is there somebody that can take a look at this ? or get something 
similar that he want to share ?

Jonathan

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Jonathan Dumaresq wrote:
> Hi all,
>
> I try to make the freertos sam7x256 project sample working. I got it
> working right when I use the makefile, boot.S and atmel-rom.ld that came
> with freertos.
>
> Now I want to use the cstartup.S, new ld files and new makefile from the
> gamma_sample.
>
> I Have not been able to start the demo anymore. I want to use those new
> file because I would like to be able to have my vector in ram and use
> the garbage collector too.

I have not done much with FreeRTOS but AFAIK it uses the SWI-Interrupt 
for context-switching. The gamma-example includes it's own swi-handler 
which does not know anything context-switching or FreeRTOS. I have used 
the SWI for operations that must be done a privileged mode since the 
application runs in user-mode. This is not really needed for smaller 
ARM-controller. If the application runs in supervisor-mode as in the 
FreeRTOS example you do not need SWI for i.e. enabling/disabling IRQ on 
core-level.

With "garbage collection" I expect you mean the unused code removal 
feature. For this you just need:
- make sure the vectors are not removed (KEEP in linker-script)
- either ENTRY must be given in linker-script or the init-functions must 
be located in a section that is used with KEEP
- make sure the "wildcard" is in the linker-script for the section (i.e. 
not just *(.text) but *(.text .text.*), same for data, rodata, bss
- add -ffunction-sections to the compiler-options
- add -gc-sections to the linker options (when called from the frontend 
with -Wl,--gc-sections

For "vectors in RAM":
- place the vector-implementation in the working code into an extra 
section
  (usually by using the .section diretive in the source-code)
- make sure this section is linked to the .data-segment as first entry 
for .data in the linker-script with this the linker will reserve space 
for the vectors and the startup-code will copy them into RAM
- remap (see AT91 datasheet)

See examples from the Atmel software-package might show this better than 
my over-complicated gamma-example.

> So now, I'm a little bit lost. I attached the files That I have modified
> to get the freertos demo working.
The main problem should be the swi-handling. FreeRTOS needs it but you 
code uses it for something else.

> is there somebody that can take a look at this ? or get something
> similar that he want to share ?
I just had a quick look into your code. Sorry, no time to modify it as 
needed but it might be easier to modify the original FreeRTOS example 
for the additional features.

Hope this helps at least a little bit.
Martin

von Jonathan D. (dumarjo)


Rate this post
useful
not useful
Hi,

This is more than with need for the explanation. We got it running. We 
are just not much familiar in the startup files... Now we are :P

We have correctly redirected the SWI handling in RAM with the remap 
feature.

So now we have something functionnal.

I'll like to tell you that your explanation are always precise, exact 
and educative !

continue your great work

Jonathan

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.