Display a post-build warning indicating to the user that the standard C
library was used instead of the small C library if the former is not
supported.
We disable C++ static destructors as best as possible in the various
toolchains, trying to eliminate unwanted destructor code. We don't want
to waste RAM or ROM on the C++-standard-specified behaviour of running
all statically-constructed objects' destructors in reverse order on
exit; we're never going to perform an orderly exit.
Techniques used include:
* `SingletonPtr` - makes an object be "lazily constructed" on first use,
and also eliminates its destructor. Lazy construction adds ROM+RAM
overhead.
* `__eabi_atexit` is stubbed out, preventing RAM usage by run-time
registration of static destructors.
* GCC has `exit` wrapped to kill shutdown code
* IAR has static destructors disabled in the compiler flags
Killing static destructors in the compiler is the optimum; if we only
stub out `__eabi_atexit`, the compiler is still inserting calls to it,
and referencing the destructors in those call.
Clang 8 added the compiler option `-fno-c++-static-destructors` (and the
object attributes `[[clang::no_destroy]]` and
`[[clang::always_destroy]]` for fine control).
We can hence enable that option in ARMC6 tool profiles, matching IAR.
This option appears to exist in ARM Compiler 6.11, but generates an
apparently spurious linker error about `EthernetInterface`. It works in
ARM Compiler 6.13, so this PR needs to wait until the compiler is
updated.
* Add optimised constexpr default constructor. Default construction
was previously by a heavyweight defaulted `nsapi_addr_t` parameter.
* Remove deprecated resolving constructor.
* Take `nsapi_addr_t` inputs by constant reference rather than value.
* Inline the trivial getters and setters.
* Use `unique_ptr` to manage the text buffer.
* Make `operator bool` explicit.
* Optimise some methods.
* Update to C++11 style (default initialisers, nullptr etc)
$(file > $@.in, $(filter %.o, $^)) is not supported in GNU Make 3.81.
Create the linker response file with pipe redirect from echo command.
This is tested with Cygwin make and make 3.8.1 shipped with macOS.
(cherry picked from commit 6918e6a76b)
Revert "Fixed problem with overlong command line."
This reverts commit dd02ac09a1.
See also https://github.com/ARMmbed/mbed-os/pull/12646#issuecomment-602058273
The list of object files was so long, that it got truncated by the bash (git-bash).
Error was
/usr/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
mingw32-make[1]: *** [Makefile:679: mbed-os-example-blinky-baremetal.elf] Error 1
mingw32-make: *** [Makefile:26: all] Error 2
Such a problem has aleady been reported in: https://github.com/ARMmbed/mbed-os/issues/10943#issuecomment-510064805
I fixed this problem using this answer: https://stackoverflow.com/a/37506805/5534993
Master branch contains lot of missing SPDX identifiers, we will clean them up but this will take some time. In the meantime, we should not increase the license missing files. Each PR will report if there is no license issue or positive number reported as Github status. Travis won't fail if there are issues. This will highlight the issues that anyone can fix.
As soon as master is clean, we can fix set_status and revert part of this commit.
Musca-B1 is a Cortex-M33 based target with security extension enabled.
- ARM_MUSCA_B1 is the non-secure target running mbed-os.
- ARM_MUSCA_B1_S is the secure target running TF-M.
- TF-M sources were imported and patched in previous commits.
- TF-M secure bootloader (McuBoot) for MUSCA_B1 is submitted by a
pre-built binary.
- A post-build hook concatenates The secure and non-secure binaries,
signs it and then concatenates the bootloader with the signed binary.
Change-Id: I4b36290941b5f0bb7aa7c12dda2f38b5c1e39ae2
Signed-off-by: Tamas Kaman <tamas.kaman@arm.com>
Signed-off-by: Gabor Abonyi <gabor.abonyi@arm.com>
The goal: check license offenders in pull request
This is similar to what astyle does in Travis. We get list of files being changed. Because scancode does not support list of files being scanned but rather a file or directory, we copy files to SCANCODE folder. Execute scancode license check in this folder and check for offenders.
The rules there are: code files must have a license and SDPX identifier. If they don't, we print these and ask for review.
It functions nicely there is just one workaround needed. SPDX is not always 100 percent correctly found, therefore we recheck file if no SPDX manually in the script. This proves to remove false positives.
For bootloader enabled target, it needs to have cmsis pack or provide memory override. This change fixes build failure in case of no cmsis pack but providing memory override with start being zero.
This is a workaround for the GCC not using the strong symbols from
C files to override the weak symbols from ASM files. This GCC bug is only
present when building with the link-time optimizer (LTO) enabled. For
more details please see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83967
This can be fixed by changing the order of object files in the linker
command; objects providing the weak symbols and compiled from assembly
must be listed before the objects providing the strong symbols.
To keep things simple, ALL object files from ASM are listed before
other object files.
Disable the lto for the default develop and release prifiles and move
the flags to tools/profiles/extensions/lto.json profile.
Usage:
mbed compile --profile release --profile tools/profiles/extensions/lto.json
This fixes the undefined reference to 'main' that arose after adding
the "-flto" flag to compilation.
This was the case for combined "-Wl,--wrap,main" and "-flto" flags.
According to GCC man:
To use the link-time optimizer, -flto and optimization options should be
specified at compile time and during the final link. It is recommended
that you compile all the files participating in the same link with the
same options and also specify those options at link time.
Additionally, move the '-g3' flag out of 'common' flags in the debug
profile. Although the '-g' is correctly ignored by the linker, the
'-glevel' is not and causes a build error "ld: unrecognized option
'-g3'".
Adding a new target of HW development kit using [Samsung Exynos i S111](https://www.samsung.com/semiconductor/minisite/exynos/products/iot/exynos-i-s111/) module to Mbed-OS.
This will widen the HW choices of Mbed-OS enabled NB-IoT, GNSS and Security (eFuse, AES, SHA-2, PKA, Secure Storage, Security Sub-System, [PUF](https://en.wikipedia.org/wiki/Physical_unclonable_function)) modules.
Target Name: S5JS100
Co-authored-by: Ivan Galkin <ivan.galkin@samsung.com>
Co-authored-by: Seokwon Lee <swon.lee@samsung.com>
Co-authored-by: Zhizhe Zhu <zhizhe.zhu@samsung.com>
Co-authored-by: Xinyi Zhao <xinyi.zhao@samsung.com>
This call to sorted does nothing in Python 2, as there is no way to sort a list
of Exceptions without providing a key.
In Python 3 this call fails with an error as there is no comparison implemented
for the jsonschema.exceptions.ValidationError Exception.
This is fixed by providing the key str, which sorts by the str representation of
the Exception.
The psa_setup.c.tpl jinja template would strip whitespace from before
the partition name comment when inserting non-test partition database
entries. Fix the template to generate psa_setup.c with the partition
name comment properly indented.
Assert it properly and thus give out the target name where the
issue is, rather than just error out with KeyError and leave the
poor sod wondering where exactly the issue is.
Before:
```
=================================== FAILURES ===================================
_____________________________ test_bl_has_sectors ______________________________
def test_bl_has_sectors():
"""Assert a bootloader supporting pack has sector information"""
cache = Cache(True, True)
named_targets = (
target for target in TARGETS if
(hasattr(target, "device_name") and getattr(target, "bootloader_supported", False))
)
for target in named_targets:
assert target.device_name in cache.index,\
("Target %s contains invalid device_name %s" %
(target.name, target.device_name))
> assert cache.index[target.device_name]["sectors"],\
("Device name %s is misssing sector information" %
(target.device_name))
E KeyError: 'sectors'
```
After
```
___________________________________________________ test_bl_has_sectors ___________________________________________________
def test_bl_has_sectors():
"""Assert a bootloader supporting pack has sector information"""
# ToDo: validity checks for the information IN the sectors!
cache = Cache(True, True)
named_targets = (
target for target in TARGETS if
(hasattr(target, "device_name") and getattr(target, "bootloader_supported", False))
)
for target in named_targets:
assert target.device_name in cache.index,\
("Target %s contains invalid device_name %s" %
(target.name, target.device_name))
> assert "sectors" in cache.index[target.device_name],\
("Target %s does not have sectors" %
(target.name))
E AssertionError: Target NUCLEO_L073RZ does not have sectors
E assert 'sectors' in {'algorithms': [{'default': True, 'file_name': 'CMSIS/Flash/STM32L0xx_192.FLM', 'ram_size': None, 'ram_start': None, ....on_secure_callable': False, 'peripheral': False, ...}, 'default': True, 'size': 196608, 'start': 134217728, ...}}, ...}
```
This helps you finding the offending target a bit faster.
Kudos to Jammu Kekkonen (jammu.kekkonen@arm.com) to figuring out how to actually
run this test & the assertion.
Ref: Mbed OS issue #12219
Per feedback from STM the correct ROM size is 1 MB, instead of
16 MB. The KEIL source information is (in the pack itself) wrong, since
the KEIL webpage lists it as a 16 MB part, too - but if you look into
other sources - it is indeed 1 MB.
SPIFReducedBlockDevice parameters come from mbed_lib.json if not provided
explicitly.
Introduced an app config file for running filesystem tests with RSPIF
block device
SPIFBlockDevice parameters come from mbed_lib.json if not provided
explicitly.
Introduced an app config file for running filesystem tests with SPIF
modules
QSPIFBlockDevice parameters come from mbed_lib.json if not provided
explicitly.
Introduced an app config file for running filesystem tests with QSPIF
modules
- 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.
Update the CMSIS-pack info to `index.json` in arm_pack_manager -folder.
The update happens via python project.py --update-packs and a modified
version of the cmsis-pack-manager tool, which allows the download of
(most) CMSIS-pack files. The changes for this family ONLY are then updated
to the `index.json` -file.
Mbed OS PR #12093 need this change, as they refer to a target (device_name)
from the updated CMSIS-packs.
Ref: https://github.com/ARMmbed/mbed-os/pull/12093
Ideally, there is nothing wrong, but it seems to produce AStyle
error when release script runs for PSA Auto-generated files.
Therefore removed the spaces from the problematic line.
Fixes#12084
Signed-off-by: Vikas Katariya <Vikas.Katariya@arm.com>
We removed catching and passing, we want to know for any misconfiguration if bootloader
is supported. Regions should check if bootloader is supported. In case not, just return.
Otherwise we catch any error.
This should help us to uncover missing regions or other config error (in case bootloader
is enabled via bootloader_supported set to true).
Currently any misconfiguration of, for example, bootloader feature will cause the
build system to just silently drop it and continue building which can lead to
completed builds of something the user didn't want to build in worst case and
failing builds after compilation (=wasted time) in the best.
For GCC we're being cautious by passing the
`-fno-delete-null-pointer-checks`. This option prevents some
optimisation opportunities, so removing it can reduce code size.
One particular optimisation loss occurs in `Callback` where a test
similar to this occurs:
extern void myfunc();
inline void foo(void (*fnptr)())
{
if (fnptr) {
do A;
} else {
do B;
}
};
foo(myfunc);
With `-fno-delete-null-pointer-checks`, the compiler does not assume
that `&myfunc` is non-null, and inserts the "null check" - seeing if the
address is 0. But performing that test of the address is incorrect
anyway - if myfunc actually could be at address 0, we'd still want to do
A.
Anyway, we do not have an equivalent option enabled for either Clang or
IAR, and we have performed clean-ups avoiding issues with
apparently-null vector tables in Clang already, for example #10534.
Therefore it should(TM) be safe to remove the option for GCC. We do not
have general data or code at address 0, only vectors are likely to be
there, so it does not make sense to be globally restricting code
generation for that.
Planning to update to supporting GCC 9 as found in GNU Tools for Arm
Embedded Processors 9-2019q4-major.
Newer GCC in particular supports ARMv8-M security extensions, and
link-time optimisation - two areas of interest.
Should be no code changes required, but need to change the warning in
the toolchain script.
- add --inline option to linker flags
Some routines are so small that they can fit in the space of the
instruction that calls the routine. Use this option to make the
linker replace the call of a routine with the body of the routine,
where applicable.
Currently mbed-os-example-blinky and mbed-os-example-wifi are built for each and every target in Mbed OS. This will change that only DISCO_L475VG_IOT01A is built for mbed-os-example-wifi. DISCO_L475VG_IOT01A was chosen as its one of the wi-fi supported boards and having integrated wi-fi.
The retarget code allocates an array of FileHandle* for console and file
handling (filehandles). A tiny target only needs a console (putc/getc).
There is no need for file handling.
The POSIX layer and the array of FileHandle* is not required for small
targets that only need a console ; this code is optionally compiled
out if the configuration parameter platform.stdio-minimal-console-only is
set to `"true"`.
Since the offline build is made to auto-generate PSA related components
and services for Secure targets, we can change the output directory to
update the files in the respective locations.
TARGET_PSA
--TARGET_MBED_SPM
--COMPONENT_SPE
psa_setup.c
--TARGET_TFM
--COMPONENT_SPE
--inc
tfm_partition_defs.inc
tfm_partition_list.inc
tfm_service_list.inc
tfm_spm_signal_defs.h
--services
--inc
autogen_sid.h
mbed_spm_partitions.h
The release script is been modified to commit these files if there are
any changes detected when `--commit` argument is passed.
Cleaning of auto-generated is been removed as it uses the main directory
for its operations, but PSA auto-generation will work if any of the
service and application-based manifests are updated.
Signed-off-by: Vikas Katariya <Vikas.Katariya@arm.com>
Only generate PSA headers/source related to components and services
when Secure build is initiated during compile time of PSA targets.
Let the Non-secure build rely on the checked-in files already present.
Signed-off-by: Vikas Katariya <Vikas.Katariya@arm.com>
Build system was using an internal feature of the Pool class that is unavailable
in a py3 system. This would cause an exception if tool execution failed.
Offending code has now been removed
Manually replaced the existing STM32H7 section and replaced it with the
context of updated `index.json` that pulled in the Keil packs available
today, as of 18th October, 2019.
See related PR; https://github.com/ARMmbed/mbed-os/pull/11707
All scripts pertaining to example projects tests should be in the same
directory. The test framework uses Python2 therefore this script also needs
to be Python2 compatible.
- remove "mbed" and "test-repo-source" key
- add "sub-repo-example" key as an indicator if an example has sub examples
- add "subs" key to sotre sub examples names
Add 2 targets for DISCO_H747I dualcore:
* DISCO_H747I -> for CM7 core
* DISCO_H747I_CM4 -> for CM4 core
Current restrictions:
* TICKLESS deactivated
* DeepSleep not supported (DeepSleep wrapped to sleep)
Warning: use of the same IP (example I2C1) by both core at the same time is not prevented,
but is strongly not recommended.
Some Hardware Semaphore are use for common IP, to manage concurrent access by both cores: Flash, GPIO, RCC.
Warning: Drag and drop of binary to DISCO_H747I will flash CM7.
In order to flash CM4, one can use STM32 CubeProgrammer tool.
Something on Travis CI's side has changed such that invoking the 'wait' command within a script attempts to wait on some other jobs in addition to those spawned within the CI job.
Workaround is to explicitly collect the PIDs for processes spawned within the script and only wait on those.