mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12068 from rajkan01/feature_bare_metal
Enabling small C library option and deprecating uARM toolchainpull/12055/head
commit
fc2a71064d
|
|
@ -37,6 +37,24 @@
|
||||||
"target_overrides": {
|
"target_overrides": {
|
||||||
"*": {
|
"*": {
|
||||||
"mbed-trace.fea-ipv6": false
|
"mbed-trace.fea-ipv6": false
|
||||||
|
},
|
||||||
|
"K64F": {
|
||||||
|
"target.default_lib": "small"
|
||||||
|
},
|
||||||
|
"K66F": {
|
||||||
|
"target.default_lib": "small"
|
||||||
|
},
|
||||||
|
"NUCLEO_F303RE": {
|
||||||
|
"target.default_lib": "small"
|
||||||
|
},
|
||||||
|
"NUCLEO_F411RE": {
|
||||||
|
"target.default_lib": "small"
|
||||||
|
},
|
||||||
|
"NUCLEO_F429ZI": {
|
||||||
|
"target.default_lib": "small"
|
||||||
|
},
|
||||||
|
"DISCO_L475VG_IOT01A": {
|
||||||
|
"target.default_lib": "small"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ void test_case_c_string_x_X()
|
||||||
TEST_ASSERT_EQUAL_STRING("8000 C8E 3e7 64 1 0 1 1087 3e7 101B 7ff8 1869F", buffer);
|
TEST_ASSERT_EQUAL_STRING("8000 C8E 3e7 64 1 0 1 1087 3e7 101B 7ff8 1869F", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(__NEWLIB_NANO)
|
||||||
void test_case_c_string_f_f()
|
void test_case_c_string_f_f()
|
||||||
{
|
{
|
||||||
CLEAN_BUFFER;
|
CLEAN_BUFFER;
|
||||||
|
|
@ -74,6 +75,7 @@ void test_case_c_string_e_E()
|
||||||
sprintf(buffer, "%e %E %e %E %e %E %e %E %e %E %e", FLOATS);
|
sprintf(buffer, "%e %E %e %E %e %E %e %E %e %E %e", FLOATS);
|
||||||
TEST_ASSERT_EQUAL_STRING("2.000000e-03 9.243000E-01 1.591320e+01 7.917737E+02 6.208200e+03 2.571950E+04 4.268160e+05 6.429271E+06 4.246802e+07 2.120065E+08 6.579048e+03", buffer);
|
TEST_ASSERT_EQUAL_STRING("2.000000e-03 9.243000E-01 1.591320e+01 7.917737E+02 6.208200e+03 2.571950E+04 4.268160e+05 6.429271E+06 4.246802e+07 2.120065E+08 6.579048e+03", buffer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void test_case_c_string_strtok()
|
void test_case_c_string_strtok()
|
||||||
{
|
{
|
||||||
|
|
@ -113,11 +115,15 @@ Case cases[] = {
|
||||||
Case("C strings: %i %d integer formatting", test_case_c_string_i_d, greentea_failure_handler),
|
Case("C strings: %i %d integer formatting", test_case_c_string_i_d, greentea_failure_handler),
|
||||||
Case("C strings: %u %d integer formatting", test_case_c_string_u_d, greentea_failure_handler),
|
Case("C strings: %u %d integer formatting", test_case_c_string_u_d, greentea_failure_handler),
|
||||||
Case("C strings: %x %E integer formatting", test_case_c_string_x_X, greentea_failure_handler),
|
Case("C strings: %x %E integer formatting", test_case_c_string_x_X, greentea_failure_handler),
|
||||||
|
#if !defined(__NEWLIB_NANO)
|
||||||
|
//In build tools, GCC with Newlib-nano linker option "-u _printf_float" is not configured
|
||||||
|
//to enable printf floating format. So disabling floating format test case.
|
||||||
Case("C strings: %f %f float formatting", test_case_c_string_f_f, greentea_failure_handler),
|
Case("C strings: %f %f float formatting", test_case_c_string_f_f, greentea_failure_handler),
|
||||||
#ifndef MBED_MINIMAL_PRINTF
|
#ifndef MBED_MINIMAL_PRINTF
|
||||||
Case("C strings: %e %E float formatting", test_case_c_string_e_E, greentea_failure_handler),
|
Case("C strings: %e %E float formatting", test_case_c_string_e_E, greentea_failure_handler),
|
||||||
Case("C strings: %g %g float formatting", test_case_c_string_g_g, greentea_failure_handler),
|
Case("C strings: %g %g float formatting", test_case_c_string_g_g, greentea_failure_handler),
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
|
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1572,6 +1572,14 @@ extern "C" {
|
||||||
|
|
||||||
} // end of extern "C"
|
} // end of extern "C"
|
||||||
|
|
||||||
|
#if defined(__MICROLIB)
|
||||||
|
extern "C" {
|
||||||
|
MBED_WEAK void __aeabi_assert(const char *expr, const char *file, int line)
|
||||||
|
{
|
||||||
|
mbed_assert_internal(expr, file, line);
|
||||||
|
}
|
||||||
|
} // end of extern "C"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,3 @@ void mbed_toolchain_init()
|
||||||
/* Run the C++ global object constructors */
|
/* Run the C++ global object constructors */
|
||||||
$Super$$__cpp_initialize__aeabi_();
|
$Super$$__cpp_initialize__aeabi_();
|
||||||
}
|
}
|
||||||
|
|
||||||
MBED_WEAK void __aeabi_assert(const char *expr, const char *file, int line)
|
|
||||||
{
|
|
||||||
mbed_assert_internal(expr, file, line);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,15 @@
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "mbed_critical.h"
|
|
||||||
#include "mbed_boot.h"
|
#include "mbed_boot.h"
|
||||||
|
|
||||||
|
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
|
||||||
|
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
|
||||||
|
|
||||||
|
#if !defined(__MICROLIB)
|
||||||
|
|
||||||
|
#include "mbed_critical.h"
|
||||||
#include <rt_misc.h>
|
#include <rt_misc.h>
|
||||||
#include "mbed_rtos_storage.h"
|
#include "mbed_rtos_storage.h"
|
||||||
#include "cmsis_os2.h"
|
#include "cmsis_os2.h"
|
||||||
|
|
@ -27,8 +32,6 @@
|
||||||
__value_in_regs struct __argc_argv __rt_lib_init(unsigned heapbase, unsigned heaptop);
|
__value_in_regs struct __argc_argv __rt_lib_init(unsigned heapbase, unsigned heaptop);
|
||||||
void _platform_post_stackheap_init(void);
|
void _platform_post_stackheap_init(void);
|
||||||
|
|
||||||
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
|
|
||||||
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
|
|
||||||
|
|
||||||
#if !defined(HEAP_START)
|
#if !defined(HEAP_START)
|
||||||
// Heap here is considered starting after ZI ends to Stack start
|
// Heap here is considered starting after ZI ends to Stack start
|
||||||
|
|
@ -252,3 +255,47 @@ __USED void _mutex_free(mutex *m)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* RTX_NO_MULTITHREAD_CLIB */
|
#endif /* RTX_NO_MULTITHREAD_CLIB */
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[];
|
||||||
|
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Length[];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mbed entry point for the MICROLIB toolchain
|
||||||
|
*
|
||||||
|
* Override the microlib function _main_init to run code earlier in
|
||||||
|
* the boot sequence. The function _main_init is responsible for invoking main.
|
||||||
|
* This function must be placed in the ".ARM.Collect" section
|
||||||
|
* or it won't get called.
|
||||||
|
*/
|
||||||
|
void _main_init(void) __attribute__((section(".ARM.Collect$$$$000000FF")));
|
||||||
|
void _main_init(void)
|
||||||
|
{
|
||||||
|
/* microlib only supports the two region memory model */
|
||||||
|
mbed_stack_isr_start = (unsigned char *) Image$$ARM_LIB_STACK$$ZI$$Base;
|
||||||
|
mbed_stack_isr_size = (uint32_t) Image$$ARM_LIB_STACK$$ZI$$Length;
|
||||||
|
|
||||||
|
mbed_heap_start = (unsigned char *) Image$$ARM_LIB_HEAP$$ZI$$Base;
|
||||||
|
mbed_heap_size = (uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Length;
|
||||||
|
|
||||||
|
mbed_init();
|
||||||
|
mbed_rtos_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void $Sub$$__cpp_initialize__aeabi_(void);
|
||||||
|
void $Super$$__cpp_initialize__aeabi_(void);
|
||||||
|
void $Sub$$__cpp_initialize__aeabi_(void)
|
||||||
|
{
|
||||||
|
/* This should invoke C++ initializers but we keep
|
||||||
|
* this empty and invoke them RTX is initialized.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void mbed_toolchain_init()
|
||||||
|
{
|
||||||
|
/* Run the C++ global object constructors */
|
||||||
|
$Super$$__cpp_initialize__aeabi_();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(__MICROLIB)
|
||||||
|
|
|
||||||
|
|
@ -36,25 +36,39 @@
|
||||||
#define MBED_APP_SIZE 0x100000
|
#define MBED_APP_SIZE 0x100000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_RAM_START)
|
||||||
|
#define MBED_RAM_START 0x20000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_RAM_SIZE)
|
||||||
|
#define MBED_RAM_SIZE 0x00020000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||||
#define MBED_BOOT_STACK_SIZE 0x400
|
#define MBED_BOOT_STACK_SIZE 0x400
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Stack_Size MBED_BOOT_STACK_SIZE
|
; 97 vectors * 4 bytes = 388 bytes to reserve (0x184) 8-byte aligned = 0x188 (0x184 + 0x4)
|
||||||
|
#define VECTOR_SIZE 0x188
|
||||||
|
|
||||||
|
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE)
|
||||||
|
|
||||||
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
|
|
||||||
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
||||||
*.o (RESET, +First)
|
*.o (RESET, +First)
|
||||||
*(InRoot$$Sections)
|
*(InRoot$$Sections)
|
||||||
.ANY (+RO)
|
.ANY (+RO)
|
||||||
}
|
}
|
||||||
|
|
||||||
; 97 vectors * 4 bytes = 388 bytes to reserve (0x184) 8-byte aligned = 0x188 (0x184 + 0x4)
|
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
|
||||||
RW_IRAM1 (0x20000000+0x188) (0x00020000-0x188-Stack_Size) { ; RW data
|
|
||||||
.ANY (+RW +ZI)
|
.ANY (+RW +ZI)
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LIB_STACK (0x20000000+0x00020000) EMPTY -Stack_Size { ; stack
|
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,30 @@
|
||||||
#define MBED_APP_START 0x08000000
|
#define MBED_APP_START 0x08000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
; STM32F303RE: 512KB FLASH (0x80000)
|
||||||
#if !defined(MBED_APP_SIZE)
|
#if !defined(MBED_APP_SIZE)
|
||||||
#define MBED_APP_SIZE 0x80000
|
#define MBED_APP_SIZE 0x80000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
;64KB SRAM (0x10000)
|
||||||
|
#if !defined(MBED_RAM_START)
|
||||||
|
#define MBED_RAM_START 0x20000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_RAM_SIZE)
|
||||||
|
#define MBED_RAM_SIZE 0x10000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||||
#define MBED_BOOT_STACK_SIZE 0x400
|
#define MBED_BOOT_STACK_SIZE 0x400
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Stack_Size MBED_BOOT_STACK_SIZE
|
; 101 vectors = 404 bytes (0x194) 8-byte aligned = 0x198 (0x194 + 0x4) to be reserved in RAM
|
||||||
|
#define VECTOR_SIZE 0x198
|
||||||
|
|
||||||
|
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE)
|
||||||
|
|
||||||
; STM32F303RE: 512KB FLASH (0x80000) + 64KB SRAM (0x10000) + 16KB CCMRAM (0x4000)
|
|
||||||
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
|
|
||||||
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
||||||
|
|
@ -51,12 +64,14 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
.ANY (+RO)
|
.ANY (+RO)
|
||||||
}
|
}
|
||||||
|
|
||||||
; 101 vectors = 404 bytes (0x194) 8-byte aligned = 0x198 (0x194 + 0x4) to be reserved in RAM
|
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
|
||||||
RW_IRAM1 (0x20000000+0x198) (0x10000-0x198-Stack_Size) { ; RW data
|
|
||||||
.ANY (+RW +ZI)
|
.ANY (+RW +ZI)
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LIB_STACK (0x20000000+0x10000) EMPTY -Stack_Size { ; stack
|
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
|
||||||
}
|
}
|
||||||
|
|
||||||
CCMRAM (0x10000000) (0x4000) {
|
CCMRAM (0x10000000) (0x4000) {
|
||||||
|
|
|
||||||
|
|
@ -32,26 +32,36 @@
|
||||||
#define MBED_APP_START 0x08000000
|
#define MBED_APP_START 0x08000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
; STM32F411RE: 512 KB FLASH (0x80000)
|
||||||
#if !defined(MBED_APP_SIZE)
|
#if !defined(MBED_APP_SIZE)
|
||||||
#define MBED_APP_SIZE 0x80000
|
#define MBED_APP_SIZE 0x80000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
; 128 KB SRAM (0x20000)
|
||||||
|
#if !defined(MBED_RAM_START)
|
||||||
|
#define MBED_RAM_START 0x20000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_RAM_SIZE)
|
||||||
|
#define MBED_RAM_SIZE 0x20000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||||
#define MBED_BOOT_STACK_SIZE 0x400
|
#define MBED_BOOT_STACK_SIZE 0x400
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Stack_Size MBED_BOOT_STACK_SIZE
|
; Total: 102 vectors = 408 bytes (0x198) to be reserved in RAM
|
||||||
|
#define VECTOR_SIZE 0x198
|
||||||
|
|
||||||
#define MBED_RAM_START 0x20000000
|
|
||||||
#define MBED_RAM_SIZE 0x20000
|
|
||||||
#define MBED_VECTTABLE_RAM_START (MBED_RAM_START)
|
|
||||||
#define MBED_VECTTABLE_RAM_SIZE 0x198
|
|
||||||
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
|
|
||||||
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
|
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
|
||||||
#define MBED_RAM0_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
|
|
||||||
#define MBED_RAM0_SIZE (MBED_RAM_SIZE - MBED_VECTTABLE_RAM_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
|
|
||||||
|
|
||||||
; STM32F411RE: 512 KB FLASH (0x80000) + 128 KB SRAM (0x20000)
|
#define MBED_IRAM1_START (MBED_RAM_START + VECTOR_SIZE + MBED_CRASH_REPORT_RAM_SIZE)
|
||||||
|
#define MBED_IRAM1_SIZE (MBED_RAM_SIZE - VECTOR_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
|
||||||
|
|
||||||
|
|
||||||
|
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE+MBED_CRASH_REPORT_RAM_SIZE)
|
||||||
|
|
||||||
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
|
|
||||||
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
||||||
|
|
@ -60,15 +70,16 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
.ANY (+RO)
|
.ANY (+RO)
|
||||||
}
|
}
|
||||||
|
|
||||||
RW_m_crash_data MBED_CRASH_REPORT_RAM_START EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
|
RW_m_crash_data (MBED_RAM_START+VECTOR_SIZE) EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
|
||||||
}
|
}
|
||||||
|
|
||||||
; Total: 102 vectors = 408 bytes (0x198) to be reserved in RAM
|
RW_IRAM1 MBED_IRAM1_START MBED_IRAM1_SIZE { ; RW data
|
||||||
RW_IRAM1 (MBED_RAM0_START) (MBED_RAM0_SIZE-Stack_Size) { ; RW data
|
|
||||||
.ANY (+RW +ZI)
|
.ANY (+RW +ZI)
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LIB_STACK (MBED_RAM0_START+MBED_RAM0_SIZE) EMPTY -Stack_Size { ; stack
|
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,26 +32,33 @@
|
||||||
#define MBED_APP_START 0x08000000
|
#define MBED_APP_START 0x08000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
; 2 MB FLASH (0x200000)
|
||||||
#if !defined(MBED_APP_SIZE)
|
#if !defined(MBED_APP_SIZE)
|
||||||
#define MBED_APP_SIZE 0x200000
|
#define MBED_APP_SIZE 0x200000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
;256 KB SRAM (0x30000 + 0x10000)
|
||||||
|
#if !defined(MBED_RAM_START)
|
||||||
|
#define MBED_RAM_START 0x20000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_RAM_SIZE)
|
||||||
|
#define MBED_RAM_SIZE 0x30000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||||
#define MBED_BOOT_STACK_SIZE 0x400
|
#define MBED_BOOT_STACK_SIZE 0x400
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Stack_Size MBED_BOOT_STACK_SIZE
|
; Total: 107 vectors = 428 bytes (0x1AC) 8-byte aligned = 0x1B0 (0x1AC + 0x4) to be reserved in RAM
|
||||||
|
#define VECTOR_SIZE 0x1B0
|
||||||
|
|
||||||
#define MBED_RAM_START 0x20000000
|
|
||||||
#define MBED_RAM_SIZE 0x30000
|
|
||||||
#define MBED_VECTTABLE_RAM_START (MBED_RAM_START)
|
|
||||||
#define MBED_VECTTABLE_RAM_SIZE 0x1B0
|
|
||||||
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
|
|
||||||
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
|
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
|
||||||
#define MBED_RAM0_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
|
#define MBED_IRAM1_START (MBED_RAM_START + VECTOR_SIZE + MBED_CRASH_REPORT_RAM_SIZE)
|
||||||
#define MBED_RAM0_SIZE (MBED_RAM_SIZE - MBED_VECTTABLE_RAM_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
|
#define MBED_IRAM1_SIZE (MBED_RAM_SIZE - VECTOR_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
|
||||||
|
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE + VECTOR_SIZE + MBED_CRASH_REPORT_RAM_SIZE)
|
||||||
|
|
||||||
; 2 MB FLASH (0x200000) + 256 KB SRAM (0x30000 + 0x10000)
|
|
||||||
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
|
|
||||||
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
||||||
|
|
@ -60,19 +67,16 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
.ANY (+RO)
|
.ANY (+RO)
|
||||||
}
|
}
|
||||||
|
|
||||||
RW_m_crash_data MBED_CRASH_REPORT_RAM_START EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
|
RW_m_crash_data (MBED_RAM_START+VECTOR_SIZE) EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
|
||||||
}
|
}
|
||||||
|
|
||||||
; Total: 107 vectors = 428 bytes (0x1AC) 8-byte aligned = 0x1B0 (0x1AC + 0x4) to be reserved in RAM
|
RW_IRAM1 MBED_IRAM1_START MBED_IRAM1_SIZE { ; RW data
|
||||||
RW_IRAM1 (MBED_RAM0_START) (MBED_RAM0_SIZE-Stack_Size) { ; RW data
|
|
||||||
.ANY (+RW +ZI)
|
.ANY (+RW +ZI)
|
||||||
}
|
}
|
||||||
|
|
||||||
RW_IRAM2 (0x10000000) (0x10000) { ; RW data
|
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
|
||||||
.ANY (+RW +ZI)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LIB_STACK (MBED_RAM0_START+MBED_RAM0_SIZE) EMPTY -Stack_Size { ; stack
|
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,21 +28,34 @@
|
||||||
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
|
||||||
#define MBED_BOOT_STACK_SIZE 0x400
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(MBED_APP_START)
|
#if !defined(MBED_APP_START)
|
||||||
#define MBED_APP_START 0x08000000
|
#define MBED_APP_START 0x08000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MBED_APP_SIZE)
|
; STM32L073RZ: 192KB FLASH (0x30000)
|
||||||
|
#if !defined(MBED_APP_SIZE)
|
||||||
#define MBED_APP_SIZE 0x30000
|
#define MBED_APP_SIZE 0x30000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Stack_Size MBED_BOOT_STACK_SIZE
|
; 20KB RAM (0x5000)
|
||||||
|
#if !defined(MBED_RAM_START)
|
||||||
|
#define MBED_RAM_START 0x20000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_RAM_SIZE)
|
||||||
|
#define MBED_RAM_SIZE 0x5000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||||
|
#define MBED_BOOT_STACK_SIZE 0x400
|
||||||
|
#endif
|
||||||
|
|
||||||
|
; Total: 48 vectors = 192 bytes (0xC0) to be reserved in RAM
|
||||||
|
#define VECTOR_SIZE 0xC0
|
||||||
|
|
||||||
|
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE)
|
||||||
|
|
||||||
; STM32L073RZ: 192KB FLASH (0x30000) + 20KB RAM (0x5000)
|
|
||||||
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
|
|
||||||
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
||||||
|
|
@ -51,12 +64,13 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||||
.ANY (+RO)
|
.ANY (+RO)
|
||||||
}
|
}
|
||||||
|
|
||||||
; Total: 48 vectors = 192 bytes (0xC0) to be reserved in RAM
|
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
|
||||||
RW_IRAM1 (0x20000000+0xC0) (0x5000-0xC0-Stack_Size) { ; RW data
|
|
||||||
.ANY (+RW +ZI)
|
.ANY (+RW +ZI)
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LIB_STACK (0x20000000+0x5000) EMPTY -Stack_Size { ; stack
|
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@
|
||||||
"bootloader_supported": false,
|
"bootloader_supported": false,
|
||||||
"static_memory_defines": true,
|
"static_memory_defines": true,
|
||||||
"printf_lib": "std",
|
"printf_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"console-uart": {
|
"console-uart": {
|
||||||
"help": "Target has UART console on pins STDIO_UART_TX, STDIO_UART_RX. Value is only significant if target has SERIAL device.",
|
"help": "Target has UART console on pins STDIO_UART_TX, STDIO_UART_RX. Value is only significant if target has SERIAL device.",
|
||||||
|
|
@ -1496,6 +1501,11 @@
|
||||||
"bootloader_supported": true,
|
"bootloader_supported": true,
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"network-default-interface-type": "ETHERNET"
|
"network-default-interface-type": "ETHERNET"
|
||||||
|
},
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std", "small"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"SDT64B": {
|
"SDT64B": {
|
||||||
|
|
@ -1783,6 +1793,11 @@
|
||||||
"bootloader_supported": true,
|
"bootloader_supported": true,
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"network-default-interface-type": "ETHERNET"
|
"network-default-interface-type": "ETHERNET"
|
||||||
|
},
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std", "small"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"K82F": {
|
"K82F": {
|
||||||
|
|
@ -2434,7 +2449,12 @@
|
||||||
],
|
],
|
||||||
"release_versions": ["2", "5"],
|
"release_versions": ["2", "5"],
|
||||||
"bootloader_supported": true,
|
"bootloader_supported": true,
|
||||||
"device_name": "STM32F303RE"
|
"device_name": "STM32F303RE",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std", "small"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"NUCLEO_F303ZE": {
|
"NUCLEO_F303ZE": {
|
||||||
"inherits": ["FAMILY_STM32"],
|
"inherits": ["FAMILY_STM32"],
|
||||||
|
|
@ -2572,7 +2592,12 @@
|
||||||
],
|
],
|
||||||
"release_versions": ["2", "5"],
|
"release_versions": ["2", "5"],
|
||||||
"device_name": "STM32F411RE",
|
"device_name": "STM32F411RE",
|
||||||
"bootloader_supported": true
|
"bootloader_supported": true,
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std", "small"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"NUCLEO_F412ZG": {
|
"NUCLEO_F412ZG": {
|
||||||
"inherits": ["FAMILY_STM32"],
|
"inherits": ["FAMILY_STM32"],
|
||||||
|
|
@ -2824,6 +2849,11 @@
|
||||||
"bootloader_supported": true,
|
"bootloader_supported": true,
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"network-default-interface-type": "ETHERNET"
|
"network-default-interface-type": "ETHERNET"
|
||||||
|
},
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std", "small"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MTB_STM_S2LP": {
|
"MTB_STM_S2LP": {
|
||||||
|
|
@ -4398,7 +4428,12 @@
|
||||||
],
|
],
|
||||||
"release_versions": ["2", "5"],
|
"release_versions": ["2", "5"],
|
||||||
"device_name": "STM32L475VG",
|
"device_name": "STM32L475VG",
|
||||||
"bootloader_supported": true
|
"bootloader_supported": true,
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std", "small"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"MTB_STM_L475": {
|
"MTB_STM_L475": {
|
||||||
"inherits": ["FAMILY_STM32"],
|
"inherits": ["FAMILY_STM32"],
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ from .targets import TARGET_NAMES, TARGET_MAP, CORE_ARCH, Target
|
||||||
from .libraries import Library
|
from .libraries import Library
|
||||||
from .toolchains import TOOLCHAIN_CLASSES, TOOLCHAIN_PATHS
|
from .toolchains import TOOLCHAIN_CLASSES, TOOLCHAIN_PATHS
|
||||||
from .toolchains.arm import ARMC5_MIGRATION_WARNING
|
from .toolchains.arm import ARMC5_MIGRATION_WARNING
|
||||||
|
from .toolchains.arm import UARM_TOOLCHAIN_WARNING
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
|
||||||
RELEASE_VERSIONS = ['2', '5']
|
RELEASE_VERSIONS = ['2', '5']
|
||||||
|
|
@ -242,6 +243,8 @@ def find_valid_toolchain(target, toolchain):
|
||||||
"Currently set search path: {}"
|
"Currently set search path: {}"
|
||||||
).format(toolchain_name, search_path)
|
).format(toolchain_name, search_path)
|
||||||
else:
|
else:
|
||||||
|
if toolchain_name == "uARM" or target.default_toolchain == "uARM":
|
||||||
|
end_warnings.append(UARM_TOOLCHAIN_WARNING)
|
||||||
return toolchain_name, internal_tc_name, end_warnings
|
return toolchain_name, internal_tc_name, end_warnings
|
||||||
else:
|
else:
|
||||||
if last_error:
|
if last_error:
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
"supported_toolchains": ["GCC_ARM"]
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"config": {
|
"config": {
|
||||||
"base1_1": "v_base1_1_b1",
|
"base1_1": "v_base1_1_b1",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"config": {
|
"config": {
|
||||||
"base1_1": "v_base1_1_b1",
|
"base1_1": "v_base1_1_b1",
|
||||||
|
|
@ -14,6 +19,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"config": {
|
"config": {
|
||||||
"base2_1": "v_base2_1_b2",
|
"base2_1": "v_base2_1_b2",
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": ["BOOTLOADER"],
|
"features": ["BOOTLOADER"],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0"
|
"core": "Cortex-M0"
|
||||||
},
|
},
|
||||||
"b1": {
|
"b1": {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0"
|
"core": "Cortex-M0"
|
||||||
},
|
},
|
||||||
"b1": {
|
"b1": {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"config": {
|
"config": {
|
||||||
"par1": "v_par1_base",
|
"par1": "v_par1_base",
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,11 @@
|
||||||
"par1": "v_par1_base",
|
"par1": "v_par1_base",
|
||||||
"par2": "v_par2_base",
|
"par2": "v_par2_base",
|
||||||
"par3": "v_par3_base"
|
"par3": "v_par3_base"
|
||||||
|
},
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"b1": {
|
"b1": {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"config": {
|
"config": {
|
||||||
"base1_1": "v_base1_1_b1",
|
"base1_1": "v_base1_1_b1",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0"
|
"core": "Cortex-M0"
|
||||||
},
|
},
|
||||||
"left_intermediate": {
|
"left_intermediate": {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0"
|
"core": "Cortex-M0"
|
||||||
},
|
},
|
||||||
"left_intermediate": {
|
"left_intermediate": {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"supported_toolchains": ["GCC_ARM"]
|
"supported_toolchains": ["GCC_ARM"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
"supported_toolchains": ["GCC_ARM"]
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"supported_toolchains": ["GCC_ARM"]
|
"supported_toolchains": ["GCC_ARM"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,23 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"should_pass": {
|
"should_pass": {
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,23 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"should_pass": {
|
"should_pass": {
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,23 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"should_pass": {
|
"should_pass": {
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"default_lib": "std"
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"extra_labels": [],
|
"extra_labels": [],
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
"config": {
|
"config": {
|
||||||
"base1_1": "v_base1_1_b1",
|
"base1_1": "v_base1_1_b1",
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,11 @@ def test_modify_existing_target():
|
||||||
"detect_code": [],
|
"detect_code": [],
|
||||||
"public": false,
|
"public": false,
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"bootloader_supported": false
|
"bootloader_supported": false
|
||||||
},
|
},
|
||||||
"Test_Target": {
|
"Test_Target": {
|
||||||
|
|
@ -126,6 +131,11 @@ def test_modify_existing_target():
|
||||||
"detect_code": [],
|
"detect_code": [],
|
||||||
"public": false,
|
"public": false,
|
||||||
"default_lib": "std",
|
"default_lib": "std",
|
||||||
|
"supported_c_libs": {
|
||||||
|
"arm": ["std"],
|
||||||
|
"gcc_arm": ["std", "small"],
|
||||||
|
"iar": ["std"]
|
||||||
|
},
|
||||||
"bootloader_supported": true
|
"bootloader_supported": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ sys.path.insert(0, ROOT)
|
||||||
from tools.toolchains.arm import ARM_STD, ARM_MICRO, ARMC6
|
from tools.toolchains.arm import ARM_STD, ARM_MICRO, ARMC6
|
||||||
from tools.toolchains.gcc import GCC_ARM
|
from tools.toolchains.gcc import GCC_ARM
|
||||||
from tools.toolchains.iar import IAR
|
from tools.toolchains.iar import IAR
|
||||||
|
from tools.toolchains.mbed_toolchain import UNSUPPORTED_C_LIB_EXCEPTION_STRING
|
||||||
|
from tools.utils import NotSupportedException
|
||||||
|
|
||||||
class TestArmToolchain(TestCase):
|
class TestArmToolchain(TestCase):
|
||||||
"""Test Arm classes."""
|
"""Test Arm classes."""
|
||||||
|
|
@ -30,6 +31,8 @@ class TestArmToolchain(TestCase):
|
||||||
mock_target = mock.MagicMock()
|
mock_target = mock.MagicMock()
|
||||||
mock_target.core = "Cortex-M4"
|
mock_target.core = "Cortex-M4"
|
||||||
mock_target.printf_lib = "minimal-printf"
|
mock_target.printf_lib = "minimal-printf"
|
||||||
|
mock_target.default_lib = "std"
|
||||||
|
mock_target.supported_c_libs = {"arm": ["std"]}
|
||||||
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
||||||
|
|
||||||
arm_std_obj = ARM_STD(mock_target)
|
arm_std_obj = ARM_STD(mock_target)
|
||||||
|
|
@ -40,6 +43,58 @@ class TestArmToolchain(TestCase):
|
||||||
self.assertIn("-DMBED_MINIMAL_PRINTF", arm_micro_obj.flags["common"])
|
self.assertIn("-DMBED_MINIMAL_PRINTF", arm_micro_obj.flags["common"])
|
||||||
self.assertIn("-DMBED_MINIMAL_PRINTF", arm_c6_obj.flags["common"])
|
self.assertIn("-DMBED_MINIMAL_PRINTF", arm_c6_obj.flags["common"])
|
||||||
|
|
||||||
|
def test_arm_default_lib(self):
|
||||||
|
"""Test that linker flags are correctly added to an instance of ARM."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.supported_c_libs = {"arm": ["small"]}
|
||||||
|
mock_target.default_lib = "sMALL"
|
||||||
|
mock_target.default_toolchain = "ARM"
|
||||||
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5", "ARMC6"]
|
||||||
|
arm_std_obj = ARM_STD(mock_target)
|
||||||
|
arm_micro_obj = ARM_MICRO(mock_target)
|
||||||
|
|
||||||
|
mock_target.default_toolchain = "ARMC6"
|
||||||
|
arm_c6_obj = ARMC6(mock_target)
|
||||||
|
|
||||||
|
self.assertIn("-D__MICROLIB", arm_std_obj.flags["common"])
|
||||||
|
self.assertIn("-D__MICROLIB", arm_micro_obj.flags["common"])
|
||||||
|
self.assertIn("-D__MICROLIB", arm_c6_obj.flags["common"])
|
||||||
|
|
||||||
|
self.assertIn("--library_type=microlib", arm_std_obj.flags["ld"])
|
||||||
|
self.assertIn("--library_type=microlib", arm_micro_obj.flags["ld"])
|
||||||
|
self.assertIn("--library_type=microlib", arm_c6_obj.flags["ld"])
|
||||||
|
|
||||||
|
self.assertIn("-Wl,--library_type=microlib", arm_c6_obj.flags["cxx"])
|
||||||
|
self.assertIn("--library_type=microlib", arm_c6_obj.flags["asm"])
|
||||||
|
|
||||||
|
def test_arm_default_lib_std_exception(self):
|
||||||
|
"""Test that an exception is raised if the std C library is not supported for a target on the ARM toolchain."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
||||||
|
mock_target.default_toolchain = "ARM"
|
||||||
|
mock_target.default_lib = "std"
|
||||||
|
mock_target.supported_c_libs = {"arm": ["small"]}
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
ARM_STD(mock_target)
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
ARMC6(mock_target)
|
||||||
|
|
||||||
|
|
||||||
|
def test_arm_default_lib_small_exception(self):
|
||||||
|
"""Test that an exception is raised if the small C library is not supported for a target on the ARM toolchain."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.default_lib = "small"
|
||||||
|
mock_target.supported_c_libs = {"arm": ["std"]}
|
||||||
|
mock_target.default_toolchain = "ARM"
|
||||||
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
ARM_STD(mock_target)
|
||||||
|
mock_target.default_toolchain = "ARMC6"
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
ARMC6(mock_target)
|
||||||
|
|
||||||
class TestGccToolchain(TestCase):
|
class TestGccToolchain(TestCase):
|
||||||
"""Test the GCC class."""
|
"""Test the GCC class."""
|
||||||
|
|
@ -50,6 +105,8 @@ class TestGccToolchain(TestCase):
|
||||||
mock_target.core = "Cortex-M4"
|
mock_target.core = "Cortex-M4"
|
||||||
mock_target.printf_lib = "minimal-printf"
|
mock_target.printf_lib = "minimal-printf"
|
||||||
mock_target.supported_toolchains = ["GCC_ARM"]
|
mock_target.supported_toolchains = ["GCC_ARM"]
|
||||||
|
mock_target.default_lib = "std"
|
||||||
|
mock_target.supported_c_libs = {"gcc_arm": ["std"]}
|
||||||
mock_target.is_TrustZone_secure_target = False
|
mock_target.is_TrustZone_secure_target = False
|
||||||
|
|
||||||
gcc_obj = GCC_ARM(mock_target)
|
gcc_obj = GCC_ARM(mock_target)
|
||||||
|
|
@ -70,18 +127,88 @@ class TestGccToolchain(TestCase):
|
||||||
for i in minimal_printf_wraps:
|
for i in minimal_printf_wraps:
|
||||||
self.assertIn(i, gcc_obj.flags["ld"])
|
self.assertIn(i, gcc_obj.flags["ld"])
|
||||||
|
|
||||||
|
def test_gcc_arm_default_lib(self):
|
||||||
|
"""Test that linker flags are correctly added to an instance of GCC_ARM."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.supported_c_libs = {"gcc_arm": ["small"]}
|
||||||
|
mock_target.default_lib = "sMALL"
|
||||||
|
mock_target.supported_toolchains = ["GCC_ARM"]
|
||||||
|
mock_target.is_TrustZone_secure_target = False
|
||||||
|
gcc_arm_obj = GCC_ARM(mock_target)
|
||||||
|
self.assertIn("-DMBED_RTOS_SINGLE_THREAD", gcc_arm_obj.flags["common"])
|
||||||
|
self.assertIn("-D__NEWLIB_NANO", gcc_arm_obj.flags["common"])
|
||||||
|
self.assertIn("--specs=nano.specs", gcc_arm_obj.flags["ld"])
|
||||||
|
|
||||||
|
def test_gcc_arm_default_lib_std_exception(self):
|
||||||
|
"""Test that an exception is raised if the std C library is not supported for a target on the GCC_ARM toolchain."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.default_toolchain = "ARM"
|
||||||
|
mock_target.default_lib = "std"
|
||||||
|
mock_target.supported_c_libs = {"arm": ["small"]}
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
GCC_ARM(mock_target)
|
||||||
|
|
||||||
|
def test_gcc_arm_default_lib_small_exception(self):
|
||||||
|
"""Test that an exception is raised if the small C library is not supported for a target on the GCC_ARM toolchain."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.default_lib = "small"
|
||||||
|
mock_target.supported_c_libs = {"arm": ["std"]}
|
||||||
|
mock_target.default_toolchain = "ARM"
|
||||||
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
GCC_ARM(mock_target)
|
||||||
|
|
||||||
class TestIarToolchain(TestCase):
|
class TestIarToolchain(TestCase):
|
||||||
"""Test the IAR class."""
|
"""Test the IAR class."""
|
||||||
|
|
||||||
def test_iar_minimal_printf(self):
|
def test_iar_minimal_printf(self):
|
||||||
"""Test that linker flags are correctly added to an instance of GCC_ARM."""
|
"""Test that linker flags are correctly added to an instance of IAR."""
|
||||||
mock_target = mock.MagicMock()
|
mock_target = mock.MagicMock()
|
||||||
mock_target.core = "Cortex-M4"
|
mock_target.core = "Cortex-M4"
|
||||||
mock_target.printf_lib = "minimal-printf"
|
mock_target.printf_lib = "minimal-printf"
|
||||||
mock_target.supported_toolchains = ["IAR"]
|
mock_target.supported_toolchains = ["IAR"]
|
||||||
|
mock_target.default_lib = "std"
|
||||||
|
mock_target.supported_c_libs = {"iar": ["std"]}
|
||||||
mock_target.is_TrustZone_secure_target = False
|
mock_target.is_TrustZone_secure_target = False
|
||||||
|
|
||||||
iar_obj = IAR(mock_target)
|
iar_obj = IAR(mock_target)
|
||||||
var = "-DMBED_MINIMAL_PRINTF"
|
var = "-DMBED_MINIMAL_PRINTF"
|
||||||
self.assertIn("-DMBED_MINIMAL_PRINTF", iar_obj.flags["common"])
|
self.assertIn("-DMBED_MINIMAL_PRINTF", iar_obj.flags["common"])
|
||||||
|
|
||||||
|
def test_iar_default_lib(self):
|
||||||
|
"""Test that no exception is raised when a supported c library is specified."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.supported_c_libs = {"iar": ["std"]}
|
||||||
|
mock_target.default_lib = "sTD"
|
||||||
|
mock_target.supported_toolchains = ["IAR"]
|
||||||
|
mock_target.is_TrustZone_secure_target = False
|
||||||
|
try:
|
||||||
|
IAR(mock_target)
|
||||||
|
except NotSupportedException:
|
||||||
|
self.fail(UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib))
|
||||||
|
|
||||||
|
def test_iar_default_lib_std_exception(self):
|
||||||
|
"""Test that an exception is raised if the std C library is not supported for a target on the IAR toolchain."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.microlib_supported = False
|
||||||
|
mock_target.default_lib = "std"
|
||||||
|
mock_target.supported_c_libs = {"iar": ["small"]}
|
||||||
|
mock_target.supported_toolchains = ["IAR"]
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
IAR(mock_target)
|
||||||
|
|
||||||
|
def test_iar_default_lib_small_exception(self):
|
||||||
|
"""Test that an exception is raised if the small C library is not supported for a target on the IAR toolchain."""
|
||||||
|
mock_target = mock.MagicMock()
|
||||||
|
mock_target.core = "Cortex-M4"
|
||||||
|
mock_target.microlib_supported = False
|
||||||
|
mock_target.default_lib = "small"
|
||||||
|
mock_target.supported_c_libs = {"iar": ["std"]}
|
||||||
|
mock_target.supported_toolchains = ["IAR"]
|
||||||
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
|
||||||
|
IAR(mock_target)
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,18 @@ from tools.resources import FileRef
|
||||||
|
|
||||||
ARMC5_MIGRATION_WARNING = (
|
ARMC5_MIGRATION_WARNING = (
|
||||||
"Warning: We noticed that you are using Arm Compiler 5. "
|
"Warning: We noticed that you are using Arm Compiler 5. "
|
||||||
"We are deprecating the use of Arm Compiler 5 soon. "
|
"We are deprecating the use of Arm Compiler 5. "
|
||||||
"Please upgrade your environment to Arm Compiler 6 "
|
"Please upgrade your environment to Arm Compiler 6 "
|
||||||
"which is free to use with Mbed OS. For more information, "
|
"which is free to use with Mbed OS. For more information, "
|
||||||
"please visit https://os.mbed.com/docs/mbed-os/latest/tools/index.html"
|
"please visit https://os.mbed.com/docs/mbed-os/latest/tools/index.html"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
UARM_TOOLCHAIN_WARNING = (
|
||||||
|
"Warning: We noticed that you are using uARM Toolchain. "
|
||||||
|
"We are deprecating the use of uARM Toolchain. "
|
||||||
|
"For more information on how to use the ARM toolchain with small C libraries, "
|
||||||
|
"please visit https://os.mbed.com/docs/mbed-os/latest/reference/using-small-c-libraries.html"
|
||||||
|
)
|
||||||
|
|
||||||
class ARM(mbedToolchain):
|
class ARM(mbedToolchain):
|
||||||
LINKER_EXT = '.sct'
|
LINKER_EXT = '.sct'
|
||||||
|
|
@ -71,7 +77,12 @@ class ARM(mbedToolchain):
|
||||||
raise NotSupportedException(
|
raise NotSupportedException(
|
||||||
"this compiler does not support the core %s" % target.core)
|
"this compiler does not support the core %s" % target.core)
|
||||||
|
|
||||||
if getattr(target, "default_toolchain", "ARM") == "uARM":
|
self.check_c_lib_supported(target, "arm")
|
||||||
|
|
||||||
|
if (
|
||||||
|
getattr(target, "default_toolchain", "ARM") == "uARM"
|
||||||
|
or getattr(target, "default_lib", "std") == "small"
|
||||||
|
):
|
||||||
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
|
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
|
||||||
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
|
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
|
||||||
if "-D__MICROLIB" not in self.flags['common']:
|
if "-D__MICROLIB" not in self.flags['common']:
|
||||||
|
|
@ -556,7 +567,12 @@ class ARMC6(ARM_STD):
|
||||||
"ARM/ARMC6 compiler support is required for ARMC6 build"
|
"ARM/ARMC6 compiler support is required for ARMC6 build"
|
||||||
)
|
)
|
||||||
|
|
||||||
if getattr(target, "default_toolchain", "ARMC6") == "uARM":
|
self.check_c_lib_supported(target, "arm")
|
||||||
|
|
||||||
|
if (
|
||||||
|
getattr(target, "default_toolchain", "ARMC6") == "uARM"
|
||||||
|
or getattr(target, "default_lib", "std") == "small"
|
||||||
|
):
|
||||||
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
|
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
|
||||||
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
|
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
|
||||||
if "-D__MICROLIB" not in self.flags['common']:
|
if "-D__MICROLIB" not in self.flags['common']:
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,14 @@ class GCC(mbedToolchain):
|
||||||
# Add flags for current size setting
|
# Add flags for current size setting
|
||||||
default_lib = "std"
|
default_lib = "std"
|
||||||
if hasattr(target, "default_lib"):
|
if hasattr(target, "default_lib"):
|
||||||
|
self.check_c_lib_supported(target, "gcc_arm")
|
||||||
default_lib = target.default_lib
|
default_lib = target.default_lib
|
||||||
elif hasattr(target, "default_build"):
|
elif hasattr(target, "default_build"):
|
||||||
default_lib = target.default_build
|
default_lib = target.default_build
|
||||||
|
|
||||||
if default_lib == "small":
|
if default_lib == "small":
|
||||||
self.flags["common"].append("-DMBED_RTOS_SINGLE_THREAD")
|
common_flags = ["-DMBED_RTOS_SINGLE_THREAD", "-D__NEWLIB_NANO"]
|
||||||
|
self.flags["common"].extend(common_flags)
|
||||||
self.flags["ld"].append("--specs=nano.specs")
|
self.flags["ld"].append("--specs=nano.specs")
|
||||||
|
|
||||||
self.check_and_add_minimal_printf(target)
|
self.check_and_add_minimal_printf(target)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ from distutils.version import LooseVersion
|
||||||
from tools.toolchains.mbed_toolchain import mbedToolchain, TOOLCHAIN_PATHS
|
from tools.toolchains.mbed_toolchain import mbedToolchain, TOOLCHAIN_PATHS
|
||||||
from tools.utils import run_cmd
|
from tools.utils import run_cmd
|
||||||
|
|
||||||
|
|
||||||
class IAR(mbedToolchain):
|
class IAR(mbedToolchain):
|
||||||
OFFICIALLY_SUPPORTED = True
|
OFFICIALLY_SUPPORTED = True
|
||||||
LIBRARY_EXT = '.a'
|
LIBRARY_EXT = '.a'
|
||||||
|
|
@ -54,6 +53,8 @@ class IAR(mbedToolchain):
|
||||||
build_profile=build_profile
|
build_profile=build_profile
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.check_c_lib_supported(target, "iar")
|
||||||
|
|
||||||
if target.is_TrustZone_secure_target:
|
if target.is_TrustZone_secure_target:
|
||||||
# Enable compiler security extensions
|
# Enable compiler security extensions
|
||||||
self.flags["asm"] += ["--cmse"]
|
self.flags["asm"] += ["--cmse"]
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ CORTEX_SYMBOLS = {
|
||||||
"__MBED_CMSIS_RTOS_CM", "__DSP_PRESENT=1U"],
|
"__MBED_CMSIS_RTOS_CM", "__DSP_PRESENT=1U"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNSUPPORTED_C_LIB_EXCEPTION_STRING = "{} C library option not supported for this target."
|
||||||
|
|
||||||
class mbedToolchain(with_metaclass(ABCMeta, object)):
|
class mbedToolchain(with_metaclass(ABCMeta, object)):
|
||||||
OFFICIALLY_SUPPORTED = False
|
OFFICIALLY_SUPPORTED = False
|
||||||
|
|
@ -1098,6 +1099,24 @@ class mbedToolchain(with_metaclass(ABCMeta, object)):
|
||||||
):
|
):
|
||||||
self.flags["common"].append("-DMBED_MINIMAL_PRINTF")
|
self.flags["common"].append("-DMBED_MINIMAL_PRINTF")
|
||||||
|
|
||||||
|
def check_c_lib_supported(self, target, toolchain):
|
||||||
|
"""
|
||||||
|
Check and raise an exception if the requested C library is not supported,
|
||||||
|
|
||||||
|
target.default_lib is modified to have the lowercased string of its original string.
|
||||||
|
This is done to be case insensitive when validating.
|
||||||
|
"""
|
||||||
|
if hasattr(target, "default_lib"):
|
||||||
|
target.default_lib = target.default_lib.lower()
|
||||||
|
if (
|
||||||
|
hasattr(target, "supported_c_libs") == False
|
||||||
|
or toolchain not in target.supported_c_libs
|
||||||
|
or target.default_lib not in target.supported_c_libs[toolchain]
|
||||||
|
):
|
||||||
|
raise NotSupportedException(
|
||||||
|
UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(target.default_lib)
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _overwrite_when_not_equal(filename, content):
|
def _overwrite_when_not_equal(filename, content):
|
||||||
if not exists(filename) or content != open(filename).read():
|
if not exists(filename) or content != open(filename).read():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue