Skip to content

Commit 85872bc

Browse files
committed
Make changes for Cortex-A5 support
1 parent 8a0c3c7 commit 85872bc

File tree

7 files changed

+41
-4
lines changed

7 files changed

+41
-4
lines changed

hal/source/mbed_critical_section_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static bool state_saved = false;
2626

2727
static bool are_interrupts_enabled(void)
2828
{
29-
#if defined(__CORTEX_A9)
29+
#if defined(__CORTEX_A9) || defined(__CORTEX_A5)
3030
return ((__get_CPSR() & 0x80) == 0);
3131
#else
3232
return ((__get_PRIMASK() & 0x1) == 0);

platform/source/mbed_critical.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static uint32_t critical_section_reentrancy_counter = 0;
2727

2828
bool core_util_are_interrupts_enabled(void)
2929
{
30-
#if defined(__CORTEX_A9)
30+
#if defined(__CORTEX_A9) || defined(__CORTEX_A5)
3131
return ((__get_CPSR() & 0x80) == 0);
3232
#else
3333
return ((__get_PRIMASK() & 0x1) == 0);
@@ -36,7 +36,7 @@ bool core_util_are_interrupts_enabled(void)
3636

3737
bool core_util_is_isr_active(void)
3838
{
39-
#if defined(__CORTEX_A9)
39+
#if defined(__CORTEX_A9) || defined(__CORTEX_A5)
4040
switch (__get_CPSR() & 0x1FU) {
4141
case CPSR_M_USR:
4242
case CPSR_M_SYS:

platform/source/mbed_wait_api_no_rtos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void wait_us(int us)
9191
#define LOOP_SCALER 2000
9292
#endif
9393
#elif defined __CORTEX_A
94-
#if __CORTEX_A == 9
94+
#if __CORTEX_A == 9 || __CORTEX_A == 5
9595
// Cortex-A9 can dual issue for 3 cycles per iteration (SUB,NOP) = 1, (NOP,BCS) = 2
9696
#define LOOP_SCALER 3000
9797
#endif

tools/cmake/cores/Cortex-A5.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
5+
list(APPEND common_options
6+
"-mthumb-interwork"
7+
"-marm"
8+
"-mfpu=vfpv3"
9+
"-mfloat-abi=softfp"
10+
"-mno-unaligned-access"
11+
"-mcpu=cortex-a5"
12+
)
13+
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
14+
list(APPEND common_options
15+
"-mfpu=vfpv3"
16+
"-mfloat-abi=hard"
17+
"-mcpu=cortex-a5"
18+
)
19+
endif()
20+
21+
function(mbed_set_cpu_core_definitions target)
22+
target_compile_definitions(${target}
23+
INTERFACE
24+
__CORTEX_A5
25+
ARM_MATH_CA5
26+
__FPU_PRESENT
27+
__CMSIS_RTOS
28+
__EVAL
29+
__MBED_CMSIS_RTOS_CA5
30+
)
31+
endfunction()

tools/cmake/mbed_toolchain.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ endfunction()
2525
# Set the system processor depending on the CPU core type
2626
if (MBED_CPU_CORE STREQUAL Cortex-A9)
2727
set(CMAKE_SYSTEM_PROCESSOR cortex-a9)
28+
elseif (MBED_CPU_CORE STREQUAL Cortex-A5)
29+
set(CMAKE_SYSTEM_PROCESSOR cortex-a5)
2830
elseif (MBED_CPU_CORE STREQUAL Cortex-M0+)
2931
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
3032
elseif (MBED_CPU_CORE STREQUAL Cortex-M0)

tools/targets/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"Cortex-M7F": ["M7", "CORTEX_M", "RTOS_M4_M7", "LIKE_CORTEX_M7", "CORTEX"],
5050
"Cortex-M7FD": ["M7", "CORTEX_M", "RTOS_M4_M7", "LIKE_CORTEX_M7",
5151
"CORTEX"],
52+
"Cortex-A5": ["A5", "CORTEX_A", "LIKE_CORTEX_A5", "CORTEX"],
5253
"Cortex-A9": ["A9", "CORTEX_A", "LIKE_CORTEX_A9", "CORTEX"],
5354
"Cortex-M23": ["M23", "CORTEX_M", "LIKE_CORTEX_M23", "CORTEX"],
5455
"Cortex-M23-NS": ["M23", "M23_NS", "CORTEX_M", "LIKE_CORTEX_M23",
@@ -74,6 +75,7 @@
7475
"Cortex-M7": 7,
7576
"Cortex-M7F": 7,
7677
"Cortex-M7FD": 7,
78+
"Cortex-A5": 7,
7779
"Cortex-A9": 7,
7880
"Cortex-M23": 8,
7981
"Cortex-M23-NS": 8,

tools/toolchains/mbed_toolchain.py

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
8787
"Cortex-M7FD": ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1",
8888
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
89+
"Cortex-A5": ["__CORTEX_A5", "ARM_MATH_CA5", "__FPU_PRESENT",
90+
"__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA5"],
8991
"Cortex-A9": ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT",
9092
"__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"],
9193
"Cortex-M23-NS": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "DOMAIN_NS=1",

0 commit comments

Comments
 (0)