[En-Nut-Discussion] Which is the latest greatest branch

Harald Kipp harald.kipp at egnite.de
Fri Oct 28 10:55:27 CEST 2011


Hi,

On 28.10.2011 06:19, Henrik Maier wrote:
> On 28/10/2011 3:54 AM, Thiago A. Corrêa wrote:
>>> Instead of dividing arch into arch/arm and arch/cm3, I propose to use
>>>>  arch/armv4t, arch/armv5t and arch/armv7_m. The first two should contain
>>>>  the ARM7TDMI and ARM9EJ-S architectures we currently have in arch/arm
>>>>  and the latter will take the Cortex-M4. Code, which is valid for all ARM
>>>>  architectures can be left in arch/arm.

>> What about borowing linux tree layout:
>> arm/boot
>> arm/include
>> arm/march-at91
>> arm/march-cortex
>> arm/march-s3c24xx

> So something like:
> 
> arch/arm                  [generic ARM stuff like context.c]
> arch/arm/at91       [stuff for all AT91 devices]
> arch/arm/at91/sam9  [specific to this series]
> arch/arm/at91/sam7
> ...
> arch/arm/cortex     [stuff which can be shared across all Cortex MCUs]
> arch/arm/cortex/cmsis [latest version of the CMSIS]
> arch/arm/cortex/m0
> arch/arm/cortex/m3  [not sure if we would need those "m" subdirs...]
> arch/arm/cortex/m4
> ...
> arch/arm/stm32      [generic STM32 stuff]
> arch/arm/stm32/f1   [specific to this series]
> arch/arm/stm32/f2
> arch/arm/stm32/f4
> ...
> arch/arm/lpc/lpc2xxx

The main idea is to avoid as much duplicated code as possible, right?

IMHO, the problem with Ulrich's and Thiago's suggestions is, that they
didn't properly distinguish between CPU architecture and peripheral
architecture. Your suggestion goes in this direction, but...

AT91SAM3 and STM32 are based on Cortex-M3, while AT91SAM7 is based on
ARM7TDMI. Would you suggest arch/arm/at91/sam3?

Cortex-M0 and Cortex-M1 are almost the same, providing a thumb2 subset.
Cortex-M3 and Cortex-M4 are similar too, they have a full thumb2
instruction set.

When looking to the peripherals, some SAM7 and SAM9 devices are more
similar than a new SAM7 compared to an older SAM7. The funny thing is,
that many peripherals of the ARM-SAM CPUs are available in AVR32 as well.

Ulrich's implementation of  __CORTEX__ is needless, because the GNU
compiler automatically provides __ARM_ARCH_7M__, when using option '-m
cpu=cortex-m3'. Other compilers will use similar predefined macros.

Let's assume, that all architecture dependent simply got

 #include <arch/arm.h>

then this header will will simply contain

 #if defined(__ARM_ARCH_4T__)
 #include <arch/arm/armv4t.h>
 #elif defined(__ARM_ARCH_7M__)
 #include <arch/armv7_m/cortex_m3.h>
 ...
 #else
 #error ARM architecture unknown or not specified
 #endif

The compiler automatically selects the right one.

Right now, I'm quite confident, that my solution is the most simple one.
Though, I must admit, that I haven't really checked all side effects. So
I'm curious about your responses.

Regards,

Harald



P.S.:

> dev  [device drivers which can be compiled for any architecture (wishful 
> thinking?)]

We do have a few of them already.




More information about the En-Nut-Discussion mailing list