Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmsis/device/rtos/source/mbed_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static void mbed_cpy_nvic(void)
VTOR register and for A9 for which CMSIS doesn't define NVIC_SetVector; in both cases target code is
responsible for correctly handling the vectors.
*/
#if !defined(__CORTEX_M0) && !defined(__CORTEX_A9)
#if !defined(__CORTEX_M0) && !defined(__CORTEX_A)
#ifdef NVIC_RAM_VECTOR_ADDRESS
uint32_t *old_vectors = (uint32_t *)SCB->VTOR;
uint32_t *vectors = (uint32_t *)NVIC_RAM_VECTOR_ADDRESS;
Expand All @@ -137,5 +137,5 @@ static void mbed_cpy_nvic(void)
}
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
#endif /* NVIC_RAM_VECTOR_ADDRESS */
#endif /* !defined(__CORTEX_M0) && !defined(__CORTEX_A9) */
#endif /* !defined(__CORTEX_M0) && !defined(__CORTEX_A) */
}
2 changes: 1 addition & 1 deletion hal/source/mbed_critical_section_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static bool state_saved = false;

static bool are_interrupts_enabled(void)
{
#if defined(__CORTEX_A9)
#if defined(__CORTEX_A)
return ((__get_CPSR() & 0x80) == 0);
#else
return ((__get_PRIMASK() & 0x1) == 0);
Expand Down
2 changes: 1 addition & 1 deletion hal/tests/TESTS/mbed_hal/critical_section/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using utest::v1::Case;

bool test_are_interrupts_enabled(void)
{
#if defined(__CORTEX_A9)
#if defined(__CORTEX_A)
return ((__get_CPSR() & 0x80) == 0);
#else
return ((__get_PRIMASK() & 0x1) == 0);
Expand Down
2 changes: 1 addition & 1 deletion platform/include/platform/mbed_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include<stdint.h>

#if defined(__CORTEX_M0PLUS) || defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__CORTEX_M7)\
|| defined(__CORTEX_M23) || defined(__CORTEX_A9) || defined(__CORTEX_M33)
|| defined(__CORTEX_M23) || defined(__CORTEX_A9) || defined(__CORTEX_A5) || defined(__CORTEX_M33)
#define MBED_APPLICATION_SUPPORT 1
#else
#define MBED_APPLICATION_SUPPORT 0
Expand Down
2 changes: 1 addition & 1 deletion platform/source/mbed_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#if MBED_APPLICATION_SUPPORT

#if defined(__CORTEX_A9)
#if defined(__CORTEX_A9) || defined(__CORTEX_A5)

static void powerdown_gic(void);

Expand Down
4 changes: 2 additions & 2 deletions platform/source/mbed_critical.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static uint32_t critical_section_reentrancy_counter = 0;

bool core_util_are_interrupts_enabled(void)
{
#if defined(__CORTEX_A9)
#if defined(__CORTEX_A)
return ((__get_CPSR() & 0x80) == 0);
#else
return ((__get_PRIMASK() & 0x1) == 0);
Expand All @@ -36,7 +36,7 @@ bool core_util_are_interrupts_enabled(void)

bool core_util_is_isr_active(void)
{
#if defined(__CORTEX_A9)
#if defined(__CORTEX_A)
switch (__get_CPSR() & 0x1FU) {
case CPSR_M_USR:
case CPSR_M_SYS:
Expand Down
4 changes: 2 additions & 2 deletions platform/source/mbed_sdk_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void mbed_copy_nvic(void)
VTOR register and for A9 for which CMSIS doesn't define NVIC_SetVector; in both cases target code is
responsible for correctly handling the vectors.
*/
#if !defined(__CORTEX_M0) && !defined(__CORTEX_A9)
#if !defined(__CORTEX_M0) && !defined(__CORTEX_A)
#ifdef NVIC_RAM_VECTOR_ADDRESS
uint32_t *old_vectors = (uint32_t *)SCB->VTOR;
uint32_t *vectors = (uint32_t *)NVIC_RAM_VECTOR_ADDRESS;
Expand All @@ -72,7 +72,7 @@ void mbed_copy_nvic(void)
}
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
#endif /* NVIC_RAM_VECTOR_ADDRESS */
#endif /* !defined(__CORTEX_M0) && !defined(__CORTEX_A9) */
#endif /* !defined(__CORTEX_M0) && !defined(__CORTEX_A) */
}

void mbed_init(void)
Expand Down
2 changes: 1 addition & 1 deletion platform/source/mbed_wait_api_no_rtos.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void wait_us(int us)
#define LOOP_SCALER 2000
#endif
#elif defined __CORTEX_A
#if __CORTEX_A == 9
#if __CORTEX_A == 9 || __CORTEX_A == 5
// Cortex-A9 can dual issue for 3 cycles per iteration (SUB,NOP) = 1, (NOP,BCS) = 2
#define LOOP_SCALER 3000
#endif
Expand Down
2 changes: 1 addition & 1 deletion platform/tests/TESTS/mbed_platform/stats_cpu/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DigitalOut led1(LED1);
#endif

// Targets with these cores have their RAM enough size to create threads with bigger stacks
#if defined(__CORTEX_A9) || defined(__CORTEX_M23) || defined(__CORTEX_M33) || defined(__CORTEX_M7)
#if defined(__CORTEX_A9) || defined(__CORTEX_A5) || defined(__CORTEX_M23) || defined(__CORTEX_M33) || defined(__CORTEX_M7)
#define MAX_THREAD_STACK 512
#else
#define MAX_THREAD_STACK 384
Expand Down
2 changes: 1 addition & 1 deletion rtos/tests/TESTS/mbed_rtos/malloc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ volatile bool thread_should_continue = true;
#define NUM_THREADS 4
#define THREAD_MALLOC_SIZE 100

#if defined(__CORTEX_A9)
#if defined(__CORTEX_A9) || defined(__CORTEX_A5)
#define THREAD_STACK_SIZE 512
#elif defined(__CORTEX_M23) || defined(__CORTEX_M33)
#define THREAD_STACK_SIZE 512
Expand Down
2 changes: 1 addition & 1 deletion rtos/tests/TESTS/mbed_rtos/threads/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <type_traits>

#define THREAD_STACK_SIZE 512
#if defined(__CORTEX_A9) || defined(__CORTEX_M23) || defined(__CORTEX_M33) || defined(TARGET_ARM_FM) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
#if defined(__CORTEX_A9) || defined(__CORTEX_A5) || defined(__CORTEX_M23) || defined(__CORTEX_M33) || defined(TARGET_ARM_FM) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
#define PARALLEL_THREAD_STACK_SIZE 512
#define CHILD_THREAD_STACK_SIZE 512
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
"-mfpu=vfpv3"
"-mfloat-abi=softfp"
"-mno-unaligned-access"
"-mcpu=cortex-a9"
"-mcpu=${CMAKE_SYSTEM_PROCESSOR}"
)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
list(APPEND common_options
"-mfpu=vfpv3"
"-mfloat-abi=hard"
"-mcpu=cortex-a9"
"-mcpu=${CMAKE_SYSTEM_PROCESSOR}"
)
endif()

function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_A9
ARM_MATH_CA9
__CORTEX_${MBED_CPU_CORE_CODE}
ARM_MATH_C${MBED_CPU_CORE_CODE}
__FPU_PRESENT
__CMSIS_RTOS
__EVAL
__MBED_CMSIS_RTOS_CA9
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M0+.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M0PLUS
ARM_MATH_CM0PLUS
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M0
ARM_MATH_CM0
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M3
ARM_MATH_CM1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M23-NS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ function(mbed_set_cpu_core_definitions target)
ARM_MATH_ARMV8MBL
DOMAIN_NS=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M23.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M23
ARM_MATH_ARMV8MBL
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M3
ARM_MATH_CM3
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M33-NS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ function(mbed_set_cpu_core_definitions target)
ARM_MATH_ARMV8MML
DOMAIN_NS=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M33.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M33
ARM_MATH_ARMV8MML
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M33F-NS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ function(mbed_set_cpu_core_definitions target)
DOMAIN_NS=1
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M33F.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ function(mbed_set_cpu_core_definitions target)
ARM_MATH_ARMV8MML
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M33FE-NS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function(mbed_set_cpu_core_definitions target)
DOMAIN_NS=1
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
__DSP_PRESENT=1U
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M33FE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function(mbed_set_cpu_core_definitions target)
ARM_MATH_ARMV8MML
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
__DSP_PRESENT=1U
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M4
ARM_MATH_CM4
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M4F.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ function(mbed_set_cpu_core_definitions target)
ARM_MATH_CM4
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M55.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M55
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M7.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ function(mbed_set_cpu_core_definitions target)
__CORTEX_M7
ARM_MATH_CM7
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M7F.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ function(mbed_set_cpu_core_definitions target)
ARM_MATH_CM7
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
1 change: 0 additions & 1 deletion tools/cmake/cores/Cortex-M7FD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ function(mbed_set_cpu_core_definitions target)
ARM_MATH_CM7
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()
11 changes: 10 additions & 1 deletion tools/cmake/mbed_toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ endfunction()
# Set the system processor depending on the CPU core type
if (MBED_CPU_CORE STREQUAL Cortex-A9)
set(CMAKE_SYSTEM_PROCESSOR cortex-a9)
elseif (MBED_CPU_CORE STREQUAL Cortex-A5)
set(CMAKE_SYSTEM_PROCESSOR cortex-a5)
elseif (MBED_CPU_CORE STREQUAL Cortex-M0+)
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
elseif (MBED_CPU_CORE STREQUAL Cortex-M0)
Expand Down Expand Up @@ -102,7 +104,14 @@ set(c_cxx_compile_options "") # compile options only for C/CXX
set(asm_compile_options "") # compile options only for ASM

include(toolchains/${MBED_TOOLCHAIN})
include(cores/${MBED_CPU_CORE})

set(MBED_CPU_CORE_TAG ${MBED_CPU_CORE})
if (MBED_CPU_CORE MATCHES "Cortex-A[0-9]+$")
set(MBED_CPU_CORE_TAG "Cortex-A")
string(REPLACE "Cortex-" "" MBED_CPU_CORE_CODE "${MBED_CPU_CORE}")
endif()

include(cores/${MBED_CPU_CORE_TAG})

#converts a list into a string with each of its elements seperated by a space
macro(list_to_space_separated OUTPUT_VAR)# 2nd arg: LIST...
Expand Down
1 change: 1 addition & 0 deletions tools/export/gnuarmeclipse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ def process_options(self, opts, flags_in):
'Cortex-M7': {'mcpu': 'cortex-m7', 'fpu_unit': None},
'Cortex-M7F': {'mcpu': 'cortex-m7', 'fpu_unit': 'fpv4spd16'},
'Cortex-M7FD': {'mcpu': 'cortex-m7', 'fpu_unit': 'fpv5d16'},
'Cortex-A5': {'mcpu': 'cortex-a5', 'fpu_unit': 'vfpv3'},
'Cortex-A9': {'mcpu': 'cortex-a9', 'fpu_unit': 'vfpv3'}
}

Expand Down
1 change: 1 addition & 0 deletions tools/export/mcuxpresso/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ def process_options(self, opts, flags_in, libraries):
'Cortex-M7': {'mcpu': 'cortex-m7', 'fpu_unit': None},
'Cortex-M7F': {'mcpu': 'cortex-m7', 'fpu_unit': 'fpv4spd16'},
'Cortex-M7FD': {'mcpu': 'cortex-m7', 'fpu_unit': 'fpv5d16'},
'Cortex-A5': {'mcpu': 'cortex-a5', 'fpu_unit': 'vfpv3'},
'Cortex-A9': {'mcpu': 'cortex-a9', 'fpu_unit': 'vfpv3'}
}

Expand Down
2 changes: 2 additions & 0 deletions tools/targets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"Cortex-M7F": ["M7", "CORTEX_M", "RTOS_M4_M7", "LIKE_CORTEX_M7", "CORTEX"],
"Cortex-M7FD": ["M7", "CORTEX_M", "RTOS_M4_M7", "LIKE_CORTEX_M7",
"CORTEX"],
"Cortex-A5": ["A5", "CORTEX_A", "LIKE_CORTEX_A5", "CORTEX"],
"Cortex-A9": ["A9", "CORTEX_A", "LIKE_CORTEX_A9", "CORTEX"],
"Cortex-M23": ["M23", "CORTEX_M", "LIKE_CORTEX_M23", "CORTEX"],
"Cortex-M23-NS": ["M23", "M23_NS", "CORTEX_M", "LIKE_CORTEX_M23",
Expand All @@ -74,6 +75,7 @@
"Cortex-M7": 7,
"Cortex-M7F": 7,
"Cortex-M7FD": 7,
"Cortex-A5": 7,
"Cortex-A9": 7,
"Cortex-M23": 8,
"Cortex-M23-NS": 8,
Expand Down
4 changes: 2 additions & 2 deletions tools/toolchains/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ARM(mbedToolchain):
SHEBANG = "#! armcc -E"
SUPPORTED_CORES = [
"Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4", "Cortex-M4F",
"Cortex-M7", "Cortex-M7F", "Cortex-M7FD", "Cortex-A9"
"Cortex-M7", "Cortex-M7F", "Cortex-M7FD", "Cortex-A5", "Cortex-A9"
]
ARMCC_RANGE = (LooseVersion("5.06"), LooseVersion("5.07"))
ARMCC_PRODUCT_RE = re.compile(b"Product: (.*)")
Expand Down Expand Up @@ -544,7 +544,7 @@ class ARMC6(ARM_STD):
"Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD",
"Cortex-M23", "Cortex-M23-NS", "Cortex-M33", "Cortex-M33F",
"Cortex-M33-NS", "Cortex-M33F-NS", "Cortex-M33FE-NS", "Cortex-M33FE",
"Cortex-A9"
"Cortex-A5", "Cortex-A9"
]
ARMCC_RANGE = (LooseVersion("6.10"), LooseVersion("7.0"))
LD_DIAGNOSTIC_PATTERN = re.compile(
Expand Down
2 changes: 1 addition & 1 deletion tools/toolchains/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
self.cpu.append("-mfpu=fpv5-d16")
self.cpu.append("-mfloat-abi=softfp")

if target.core == "Cortex-A9":
if target.core == "Cortex-A9" or target.core == "Cortex-A5":
self.cpu.append("-mthumb-interwork")
self.cpu.append("-marm")
self.cpu.append("-march=armv7-a")
Expand Down
2 changes: 2 additions & 0 deletions tools/toolchains/mbed_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
"Cortex-M7FD": ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1",
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
"Cortex-A5": ["__CORTEX_A5", "ARM_MATH_CA5", "__FPU_PRESENT",
"__CMSIS_RTOS", "__EVAL"],
Comment on lines +89 to +90
Copy link
Contributor Author

@Meano Meano Jun 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes to mbed_toolchain.py could be approved? @Patater

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a new core added without changing existing ones, so it should be okay

"Cortex-A9": ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT",
"__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"],
"Cortex-M23-NS": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "DOMAIN_NS=1",
Expand Down