Arduino Due port (GCC SAM3X8E)

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
Post Reply
sam0737
Posts: 4
Joined: Sun Apr 14, 2013 4:47 am

Arduino Due port (GCC SAM3X8E)

Post by sam0737 »

Hi there. First of all, this is the git repro with my commits.

https://github.com/sam0737/chibios-rt-arduino-due

I have ported the SAM3X8E (Cortex M3), SAM3X8E platform, Arduino Due board. As well as a corresponding demo wire everything up.
My dev environment is Windows with the chaintool shipped with Arduino 1.5.x, which is CodeSourcery GCC.

So far there is only PAL LLD driver. It boots, the clock and systick is initialized, PIO is changable, LED blinks, nothing more. I will add more component if time's allowed.
I didn't try to generalize the SAM3X8E > SAM3X > SAM3 family. I have been working in C# much longer than embedded C and is too surprised it could work already =P, so I aimed to make it work first.
That would be a big TODO.

BTW, if someone is faimilar with this platform, could you please look at the Linker Script? In particular

Code: Select all

ram (rwx)   : ORIGIN = 0x20070000, LENGTH = 0x00018000 /* sram, 96K */

0x20070000 doesn't sound so right to me. Shouldn't it be 0x20000000? But this is straight from linker script released by the Atmel, comes with their CMSIS implementation.

I hope these commits will be useful to the project.

P.S. Please feel free to re-phrase the copyright notice when merging. I am more than happy to transfer the copyright to the maintainer.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Arduino Due port (GCC SAM3X8E)

Post by Giovanni »

Hi,

Thanks for the code, copyright assignment is no more required for the low level drivers, the LLD license changed to Apache 2.0 too.

The code could eventually be merged if a maintainer for that family steps up.

Giovanni
theShed
Posts: 50
Joined: Tue Feb 26, 2013 3:43 pm

Re: Arduino Due port (GCC SAM3X8E)

Post by theShed »

sam0737 wrote:
BTW, if someone is faimilar with this platform, could you please look at the Linker Script? In particular

Code: Select all

ram (rwx)   : ORIGIN = 0x20070000, LENGTH = 0x00018000 /* sram, 96K */

0x20070000 doesn't sound so right to me. Shouldn't it be 0x20000000? But this is straight from linker script released by the Atmel, comes with their CMSIS implementation.


From a quick look at the datasheet:
The SAM3x family has two internal SRAM blocks SRAM0 (0x20000000-0x2007FFFF) and SRAM1 (0x20080000-0x20100000).
That particular device has 96K SRAM: 64K in SRAM0, 32K in SRAM1.

The SRAMs are aliased within their blocks; ie, for SRAM0 bits 16-18 of the address are ignored so the byte that is accessed at address 0x20000000 can also be found at
0x20010000, 0x20020000, 0x20030000 etc, up to 0x20070000.
SRAM1 is (probably) similarly aliased and will repeat every 32K. ie 0x20080000, 0x20088000...

So to make the SRAM appear as one contiguous block it is accessed via the upper alias of SRAM0 (0x20070000) and the lower alias of SRAM1 (0x20080000).

Hope that makes sense.
--
mike
sam0737
Posts: 4
Joined: Sun Apr 14, 2013 4:47 am

Re: Arduino Due port (GCC SAM3X8E)

Post by sam0737 »

Oh thanks.
I didn't realize 0x20080000 - 0x20070000 is actually NOT 64K. LOL.

I recheck the spect and have just found this in chapter 9.1.1:
The SRAM0 is accessible over System Cortex-M3 bus at address 0x2000 0000 and SRAM1 at
address 0x2008 0000. The user can see the SRAM as contiguous thanks to mirror effect, giving
0x2007 0000 - 0x2008 7FFF for SAM3X/A8, 0x2007 8000 - 0x2008 7FFF for SAM3X/A4.
ferdiado
Posts: 3
Joined: Fri May 30, 2014 7:49 pm

Re: Arduino Due port (GCC SAM3X8E)

Post by ferdiado »

Hello sam0737 and Giovani ,
I am part of a group of people who are doing a university project in Spain . We are making the acquisition of data for a bike in the MotoStudent program. Let's use an Arduino board and a mobile Android device to store and display the results in real time to the pilot .
After much research and on the basis that we should use an Arduino Due ChibiOs saw and liked as RTOS . Initially we were going to use the option of programming from the Arduino IDE , by a bookcase that locate in rtoslibs . The problem is that this library does not have support for Hal and we can not control all the processes as we should.
After investigating this and we have seen you and we implementation questions have arisen and several problems. We ask both help and clarification to our doubts and ignorance , our interest is further unleash the development , of course .
Current state in which we find :
We downloaded the latest version of ChibiStudio Preview 6.7 . We downloaded the ChibiOs has modified for the Arduino Due sam0737 . ChibiStudio delete the entire folder and copy the ChibiOs of sam0737 . Indicate that you are using Windows 7 32 bits and 64 bits.
We are following the demo of the Arduino Due and as indicated in the readme for this sample, follow the steps.
• The first problem I see is that the version that uses sam0737 ChibiOs is an unstable 2.5.2 while the current is 2.6.x Know if this point may be affecting the outcome of the solution.
• Secondly it has come to our attention that the mcuconf.h file is empty and has no data . We do not know if this is normal or not .
• Third, we find that following the steps of the demo for the Arduino Due ChibiOs following the readme . By using the "cs -make all" to compile have continued to create problems :
http://ferdiado.com/MotoStudent/Fail_cs-make.txt
Continue until the end of the compilation without creating any files , of course .
We have associated the Path as you indicate and know they are as system variables .
• However we do use the "make" sets the default ChibiStudio yes we see that it works and we have the mkdir error in bookstores inidcadas above error but then you jump on the Seller pal .
http://ferdiado.com/MotoStudent/Fail_make.txt
As we see gives us just run in association pal_lld.h Ppio failure. We are stuck at this point.
If we remove any other use of this library we compile a bin file, but we have not tried to compile it, we have this outstanding point, but it really is not useful because we can not access the Arduino board as needed.
We have another set of questions but in principle we believe that resolving this point we have solved much of other questions .
Thanks for the reply .
Fernando .
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Arduino Due port (GCC SAM3X8E)

Post by Giovanni »

Hi,

Many of those questions should be directed to the author of the port. Apparently it has not been updated since its release.

About your questions:

1) Many things changed since 2.5.2, by using that version you don't get all the improvements and fixes in the latest 2 years.

2) Strange, in official ports usually mcuconf.h is not empty. It is a port-dependent file so I can't answer this.

3) ChibiStudio does not use cs-make. Can't help here.

The error with pPio could be a bug, you may try to contact the author.

Giovanni
ferdiado
Posts: 3
Joined: Fri May 30, 2014 7:49 pm

Re: Arduino Due port (GCC SAM3X8E)

Post by ferdiado »

Giovanni wrote:Hi,

Many of those questions should be directed to the author of the port. Apparently it has not been updated since its release.

About your questions:

1) Many things changed since 2.5.2, by using that version you don't get all the improvements and fixes in the latest 2 years.

2) Strange, in official ports usually mcuconf.h is not empty. It is a port-dependent file so I can't answer this.

3) ChibiStudio does not use cs-make. Can't help here.

The error with pPio could be a bug, you may try to contact the author.

Giovanni


Giovanni Thanks for the reply.
Giovanni in principle if we created our adaptation based on the current version ChibiOs, is there a tutorial that we could continue to make the adjustment you refer us?
While we wait to see if answers sam0737.

Fernando.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Arduino Due port (GCC SAM3X8E)

Post by Giovanni »

In theory porting to 2.6.x should be simple, just add the low level driver files to the current distribution.

Porting to 3.0 would be more complex, there is a guide in the documentation section about this.

Giovanni
ferdiado
Posts: 3
Joined: Fri May 30, 2014 7:49 pm

Re: Arduino Due port (GCC SAM3X8E)

Post by ferdiado »

Thank you, we will inform you of our progress.
Post Reply