[riot-devel] Working on port to SODAQ Autonomo (SAMD21)

Kees Bakker kees at sodaq.com
Tue Jun 14 20:30:26 CEST 2016


On 13-06-16 22:39, Peter Kietzmann wrote:
> Hi Kees,
>
> honestly just now I got your actual problem and I remember what I 
> stumbled upon this morning:
>
> # define the cpu used by SAMR21 Xplained Pro board
> export CPU = samd21
> export CPU_MODEL = samr21x18a
>
> https://github.com/RIOT-OS/RIOT/blob/master/boards/samr21-xpro/Makefile.include 
>
>
> However, I won't say "for RIOT that's good enough". To summarize: The 
> main questions are (i) how to split different CPUs/MCUs with rather 
> small differences and (ii) how to reuse most of the code. Right?

Correct.

> For (ii) it would obviously be the best way to have drivers and stuff 
> in the common folder. Personally I have no idea if this is possible or 
> not, it depends on the differences. If these are too big, one needs to 
> stay with a separate CPU folder for each "family".

Yes, that is certainly possible. All these SAM devices can be handled 
with a common code base. Someone
already started such a common place: cpu/sam21_common. We should 
continue with that.

If you ask me, I'd say that already a lot of files from 
cpu/samd21/periph can be moved to cpu/sam21_common.

> For (i) won't it be enough to export the CPU_MODEL by the board and 
> adjust the include paths properly, as done e.g. here?

Yes, that is the right thing to do. For Atmel there is one more thing: 
CFLAGS must have a define like -D__SAMD21J18A__,
otherwise the correct include files aren't selected.

>
> https://github.com/RIOT-OS/RIOT/blob/master/cpu/stm32f3/include/cpu_conf.h#L27 
>
>
> One other question is the need for changing the CPU name of the Atmel 
> samr21-xpro board from "samd21" to "samr21". In your regards I think 
> it could make sense but with a solution as described in (i) above, 
> there won't be a need for that. Do I see that correctly?

I don't care too much how the CPU is called. But maybe it is useful to 
know which CPU variant
it is, like SAMD21J18A.

>
> Generally I'm not too much into Atmels product series and I would like 
> to hear Kaspar's opinion as he knows RIOTs architecture much better 
> than me.

I'd be interested to know what Kaspar thinks about it.



More information about the devel mailing list