2019-11-14 11:58:01 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# Copyright (c) 2019 Arm Limited and Contributors. All rights reserved.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
"""Test the arm toolchain."""
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
import mock
|
|
|
|
|
|
|
|
|
|
|
|
ROOT = os.path.abspath(
|
|
|
|
os.path.join(os.path.dirname(__file__), "..", "..", "..")
|
|
|
|
)
|
|
|
|
sys.path.insert(0, ROOT)
|
|
|
|
|
|
|
|
from tools.toolchains.arm import ARM_STD, ARM_MICRO, ARMC6
|
|
|
|
from tools.toolchains.gcc import GCC_ARM
|
|
|
|
from tools.toolchains.iar import IAR
|
2019-12-10 17:20:34 +00:00
|
|
|
from tools.toolchains.mbed_toolchain import UNSUPPORTED_C_LIB_EXCEPTION_STRING
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
from tools.utils import NotSupportedException
|
2019-11-14 11:58:01 +00:00
|
|
|
|
|
|
|
class TestArmToolchain(TestCase):
|
|
|
|
"""Test Arm classes."""
|
|
|
|
|
|
|
|
def test_arm_minimal_printf(self):
|
|
|
|
"""Test that linker flags are correctly added to an instance of ARM."""
|
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
|
|
|
mock_target.printf_lib = "minimal-printf"
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "std"
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"arm": ["std"]}
|
2019-11-14 11:58:01 +00:00
|
|
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
2020-01-17 13:51:41 +00:00
|
|
|
del mock_target.default_lib
|
2019-11-14 11:58:01 +00:00
|
|
|
arm_std_obj = ARM_STD(mock_target)
|
|
|
|
arm_micro_obj = ARM_MICRO(mock_target)
|
|
|
|
arm_c6_obj = ARMC6(mock_target)
|
|
|
|
|
|
|
|
self.assertIn("-DMBED_MINIMAL_PRINTF", arm_std_obj.flags["common"])
|
|
|
|
self.assertIn("-DMBED_MINIMAL_PRINTF", arm_micro_obj.flags["common"])
|
|
|
|
self.assertIn("-DMBED_MINIMAL_PRINTF", arm_c6_obj.flags["common"])
|
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_arm_c_lib(self):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
"""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"]}
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "sMALL"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
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"])
|
2020-01-22 17:45:01 +00:00
|
|
|
self.assertIn("--library_type=microlib", arm_c6_obj.flags["ld"])
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
self.assertIn("--library_type=microlib", arm_c6_obj.flags["asm"])
|
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_arm_c_lib_std_exception(self):
|
2019-12-10 17:20:34 +00:00
|
|
|
"""Test that an exception is raised if the std C library is not supported for a target on the ARM toolchain."""
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
|
|
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
|
|
|
mock_target.default_toolchain = "ARM"
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "std"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"arm": ["small"]}
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
ARM_STD(mock_target)
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
ARMC6(mock_target)
|
|
|
|
|
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_arm_c_lib_small_exception(self):
|
2019-12-10 17:20:34 +00:00
|
|
|
"""Test that an exception is raised if the small C library is not supported for a target on the ARM toolchain."""
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "small"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"arm": ["std"]}
|
|
|
|
mock_target.default_toolchain = "ARM"
|
|
|
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
ARM_STD(mock_target)
|
|
|
|
mock_target.default_toolchain = "ARMC6"
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
ARMC6(mock_target)
|
2019-11-14 11:58:01 +00:00
|
|
|
|
|
|
|
class TestGccToolchain(TestCase):
|
|
|
|
"""Test the GCC class."""
|
|
|
|
|
|
|
|
def test_gcc_minimal_printf(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.printf_lib = "minimal-printf"
|
|
|
|
mock_target.supported_toolchains = ["GCC_ARM"]
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "std"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"gcc_arm": ["std"]}
|
2019-11-14 11:58:01 +00:00
|
|
|
mock_target.is_TrustZone_secure_target = False
|
|
|
|
|
|
|
|
gcc_obj = GCC_ARM(mock_target)
|
|
|
|
|
|
|
|
self.assertIn("-DMBED_MINIMAL_PRINTF", gcc_obj.flags["common"])
|
|
|
|
|
|
|
|
minimal_printf_wraps = [
|
|
|
|
"-Wl,--wrap,printf",
|
|
|
|
"-Wl,--wrap,sprintf",
|
|
|
|
"-Wl,--wrap,snprintf",
|
|
|
|
"-Wl,--wrap,vprintf",
|
|
|
|
"-Wl,--wrap,vsprintf",
|
|
|
|
"-Wl,--wrap,vsnprintf",
|
|
|
|
"-Wl,--wrap,fprintf",
|
|
|
|
"-Wl,--wrap,vfprintf",
|
|
|
|
]
|
|
|
|
|
|
|
|
for i in minimal_printf_wraps:
|
|
|
|
self.assertIn(i, gcc_obj.flags["ld"])
|
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_gcc_arm_c_lib(self):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
"""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"]}
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "sMALL"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
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"])
|
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_gcc_arm_c_lib_std_exception(self):
|
2019-12-10 17:20:34 +00:00
|
|
|
"""Test that an exception is raised if the std C library is not supported for a target on the GCC_ARM toolchain."""
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
|
|
|
mock_target.default_toolchain = "ARM"
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "std"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"arm": ["small"]}
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
GCC_ARM(mock_target)
|
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_gcc_arm_c_lib_small_exception(self):
|
2019-12-10 17:20:34 +00:00
|
|
|
"""Test that an exception is raised if the small C library is not supported for a target on the GCC_ARM toolchain."""
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "small"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"arm": ["std"]}
|
|
|
|
mock_target.default_toolchain = "ARM"
|
|
|
|
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
GCC_ARM(mock_target)
|
2019-11-14 11:58:01 +00:00
|
|
|
|
|
|
|
class TestIarToolchain(TestCase):
|
|
|
|
"""Test the IAR class."""
|
|
|
|
|
|
|
|
def test_iar_minimal_printf(self):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
"""Test that linker flags are correctly added to an instance of IAR."""
|
2019-11-14 11:58:01 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
|
|
|
mock_target.printf_lib = "minimal-printf"
|
|
|
|
mock_target.supported_toolchains = ["IAR"]
|
2020-01-17 13:51:41 +00:00
|
|
|
del mock_target.default_lib
|
|
|
|
mock_target.c_lib = "std"
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"iar": ["std"]}
|
2019-11-14 11:58:01 +00:00
|
|
|
mock_target.is_TrustZone_secure_target = False
|
|
|
|
|
|
|
|
iar_obj = IAR(mock_target)
|
|
|
|
var = "-DMBED_MINIMAL_PRINTF"
|
|
|
|
self.assertIn("-DMBED_MINIMAL_PRINTF", iar_obj.flags["common"])
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_iar_c_lib(self):
|
2019-12-10 17:20:34 +00:00
|
|
|
"""Test that no exception is raised when a supported c library is specified."""
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
|
|
|
mock_target.supported_c_libs = {"iar": ["std"]}
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "sTD"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_toolchains = ["IAR"]
|
|
|
|
mock_target.is_TrustZone_secure_target = False
|
|
|
|
try:
|
|
|
|
IAR(mock_target)
|
|
|
|
except NotSupportedException:
|
2020-01-17 13:51:41 +00:00
|
|
|
self.fail(UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib))
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_iar_c_lib_std_exception(self):
|
2019-12-10 17:20:34 +00:00
|
|
|
"""Test that an exception is raised if the std C library is not supported for a target on the IAR toolchain."""
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "std"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"iar": ["small"]}
|
|
|
|
mock_target.supported_toolchains = ["IAR"]
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
IAR(mock_target)
|
|
|
|
|
2020-01-17 13:51:41 +00:00
|
|
|
def test_iar_c_lib_small_exception(self):
|
2019-12-10 17:20:34 +00:00
|
|
|
"""Test that an exception is raised if the small C library is not supported for a target on the IAR toolchain."""
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target = mock.MagicMock()
|
|
|
|
mock_target.core = "Cortex-M4"
|
2020-01-17 13:51:41 +00:00
|
|
|
mock_target.c_lib = "small"
|
|
|
|
del mock_target.default_lib
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
mock_target.supported_c_libs = {"iar": ["std"]}
|
|
|
|
mock_target.supported_toolchains = ["IAR"]
|
2020-01-17 13:51:41 +00:00
|
|
|
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
|
Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
It is possible to use smaller C libraries by overriding the "target.default_lib" option
with "small". This option is only currently supported for the GCC_ARM toolchain.
This override config option is now extended in the build tool for ARM toolchain.
- Add configuration option to specify libraries supported for each toolchain per targets.
- Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
- Use 2 memory region model for ARM toolchain scatter file for the following targets:
NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
- Add a warning message in the build tools to deprecate uARM toolchain.
- NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
format specifier so skipping those green tea test cases.
2019-10-08 15:04:02 +00:00
|
|
|
IAR(mock_target)
|