Skip to content

Commit

Permalink
mps3:Support NuttX running on qemu cortex-m55
Browse files Browse the repository at this point in the history
Signed-off-by: anjiahao <[email protected]>
  • Loading branch information
anjiahao1 committed Apr 25, 2024
1 parent 71f8bc6 commit d37c23b
Show file tree
Hide file tree
Showing 21 changed files with 1,430 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ config ARCH_CHIP_TLSR82
---help---
Telink tlsr82xx architectures (Customed armv6m)

config ARCH_CHIP_MPS
bool "MPS ARM Series"
---help---
MPS platform (MPS2 MPS3)

config ARCH_CHIP_QEMU_ARM
bool "QEMU virt platform (ARMv7a)"
select ARCH_HAVE_PSCI
Expand Down Expand Up @@ -1095,6 +1100,7 @@ config ARCH_CHIP
default "phy62xx" if ARCH_CHIP_PHY62XX
default "tlsr82" if ARCH_CHIP_TLSR82
default "qemu" if ARCH_CHIP_QEMU_ARM
default "mps" if ARCH_CHIP_MPS
default "goldfish" if ARCH_CHIP_GOLDFISH_ARM
default "at32" if ARCH_CHIP_AT32

Expand Down Expand Up @@ -1572,6 +1578,9 @@ endif
if ARCH_CHIP_QEMU_ARM
source "arch/arm/src/qemu/Kconfig"
endif
if ARCH_CHIP_MPS
source "arch/arm/src/mps/Kconfig"
endif
if ARCH_CHIP_GOLDFISH_ARM
source "arch/arm/src/goldfish/Kconfig"
endif
Expand Down
48 changes: 48 additions & 0 deletions arch/arm/include/mps/chip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/****************************************************************************
* arch/arm/include/mps/chip.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __ARCH_ARM_INCLUDE_MPS_CHIP_H
#define __ARCH_ARM_INCLUDE_MPS_CHIP_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

/****************************************************************************
* Pre-processor Prototypes
****************************************************************************/

#define NVIC_SYSH_PRIORITY_MIN 0xe0 /* Bits [7:5] set in minimum priority */

/****************************************************************************
* Public Types
****************************************************************************/

/****************************************************************************
* Public Data
****************************************************************************/

/****************************************************************************
* Public Functions Prototypes
****************************************************************************/

#endif /* __ARCH_ARM_INCLUDE_MPS_CHIP_H */
69 changes: 69 additions & 0 deletions arch/arm/include/mps/irq.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/****************************************************************************
* arch/arm/include/mps/irq.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/* This file should never be included directly but, rather,
* only indirectly through nuttx/irq.h
*/

#ifndef __ARCH_ARM_INCLUDE_MPS_IRQ_H
#define __ARCH_ARM_INCLUDE_MPS_IRQ_H

/****************************************************************************
* Included Files
****************************************************************************/

/****************************************************************************
* Pre-processor Prototypes
****************************************************************************/

#define NR_IRQS 130 /* Total number of interrupts */

/****************************************************************************
* Public Types
****************************************************************************/

/****************************************************************************
* Inline functions
****************************************************************************/

/****************************************************************************
* Public Data
****************************************************************************/

/****************************************************************************
* Public Function Prototypes
****************************************************************************/

#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif

#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif

#endif /* __ARCH_ARM_INCLUDE_MPS_IRQ_H */
26 changes: 26 additions & 0 deletions arch/arm/src/mps/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_CHIP_MPS

menu "MPS Chip Selection"

choice
prompt "ARM MPS Configuration"
default ARCH_CHIP_MPS3_AN547

config ARCH_CHIP_MPS3_AN547
bool "MPS3 AN547 Processor Cortexm55"
select ARCH_CORTEXM55

config ARCH_CHIP_MPS3_AN524
bool "MPS3 AN524 Processor Cortexm33"
select ARCH_CORTEXM33

endchoice

endmenu

endif
23 changes: 23 additions & 0 deletions arch/arm/src/mps/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
############################################################################
# arch/arm/src/mps/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

include armv8-m/Make.defs

CHIP_CSRCS = mps_start.c mps_serial.c mps_irq.c mps_timer.c mps_allocateheap.c
37 changes: 37 additions & 0 deletions arch/arm/src/mps/chip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/****************************************************************************
* arch/arm/src/mps/chip.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __ARCH_ARM_SRC_MPS_CHIP_H
#define __ARCH_ARM_SRC_MPS_CHIP_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>
#include <arch/mps/irq.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#define ARMV8M_PERIPHERAL_INTERRUPTS NR_IRQS

#endif /* __ARCH_ARM_SRC_MPS_CHIP_H */
71 changes: 71 additions & 0 deletions arch/arm/src/mps/mps_allocateheap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/****************************************************************************
* arch/arm/src/mps/mps_allocateheap.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>

#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/kmalloc.h>
#include <arch/board/board.h>

#include "chip.h"
#include "arm_internal.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#if defined(CONFIG_BUILD_KERNEL)
# define MM_ADDREGION kmm_addregion
#else
# define MM_ADDREGION umm_addregion
#endif

#define MPS3_DDR_BASE (void *)0x60000000
#define MPS3_DDR_SIZE (2 * 1024 * 1024 * 1024UL)

/****************************************************************************
* Private Data
****************************************************************************/

/****************************************************************************
* Private Functions
****************************************************************************/

/****************************************************************************
* Public Functions
****************************************************************************/

/****************************************************************************
* Name: arm_addregion
****************************************************************************/

#if CONFIG_MM_REGIONS > 1
void arm_addregion(void)
{
MM_ADDREGION(MPS3_DDR_BASE, MPS3_DDR_SIZE);
}
#endif
Loading

0 comments on commit d37c23b

Please sign in to comment.