Skip to content

Fix CI for branch feature-public-headers #11093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 26, 2019
2 changes: 1 addition & 1 deletion TESTS/mbed_hal/qspi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "mbed.h"
#include "qspi_api.h"
#include "hal/us_ticker_api.h"


#if !defined(QSPI_FLASH_CHIP_STRING)
Expand Down Expand Up @@ -601,4 +602,3 @@ int main()
{
Harness::run(specification);
}

1 change: 1 addition & 0 deletions TESTS/mbed_hal/qspi/qspi_test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "utest/utest.h"

#include "hal/qspi_api.h"
#include "hal/us_ticker_api.h"
#include "qspi_test_utils.h"

#include "unity/unity.h"
Expand Down
1 change: 1 addition & 0 deletions TESTS/mbed_hal/sleep/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "unity/unity.h"
#include "greentea-client/test_env.h"
#include "mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"

#include "sleep_test_utils.h"
#include "sleep_api_tests.h"
Expand Down
1 change: 1 addition & 0 deletions TESTS/mbed_hal/sleep_manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <limits.h>
#include "mbed.h"
#include "mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"
#include "../sleep/sleep_test_utils.h"
#include "sleep_manager_api_tests.h"

Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "unity/unity.h"
#include "greentea-client/test_env.h"

#include "platform/mbed_critical.h"

using namespace utest::v1;

#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/drivers/Watchdog/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(unittest-includes ${unittest-includes}

# Source files
set(unittest-sources
../drivers/Watchdog.cpp
../drivers/source/Watchdog.cpp
)

# Test files
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions drivers/source/usb/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "usb"
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

// mbed Includes
#include "mbed_assert.h"
#include "rtos/rtos_idle.h"
#include "rtos/source/rtos_idle.h"
#include "platform/mbed_power_mgmt.h"
#include "mbed_critical.h"

Expand Down Expand Up @@ -368,7 +368,7 @@ bool NRFCordioHCIDriver::get_random_static_address(ble::address_t& address)
return true;
}

ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() {
ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() {
static NRFCordioHCITransportDriver transport_driver;

static NRFCordioHCIDriver hci_driver(
Expand Down
8 changes: 7 additions & 1 deletion tools/build_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,10 +1068,16 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None,

incdirs = cmsis_res.inc_dirs + hal_res.inc_dirs + library_incdirs

# Exclude USB related source files from Mbed OS 2 build as they contain
# references to RTOS API which is also not included.
exclude_paths = [join(MBED_DRIVERS, "source", "usb")]

# Build Things
notify.info("Building library %s (%s, %s)" %
('MBED', target.name, toolchain_name))
objects = toolchain.compile_sources(mbed_resources, incdirs)
objects = toolchain.compile_sources(
mbed_resources, incdirs, exclude_paths
)
separate_objects = []

for obj in objects:
Expand Down
21 changes: 17 additions & 4 deletions tools/toolchains/mbed_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,27 @@ def get_arch_file(self, objects):

# THIS METHOD IS BEING CALLED BY THE MBED ONLINE BUILD SYSTEM
# ANY CHANGE OF PARAMETERS OR RETURN VALUES WILL BREAK COMPATIBILITY
def compile_sources(self, resources, inc_dirs=None):
def compile_sources(self, resources, inc_dirs=None, exclude_paths=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

This addition of the exclude_paths parameter will mean that it will be included the statement:

    # THIS METHOD IS BEING CALLED BY THE MBED ONLINE BUILD SYSTEM
    # ANY CHANGE OF PARAMETERS OR RETURN VALUES WILL BREAK COMPATIBILITY

It would be possible to remove this parameter when legacy build support is removed but I'm sure by then we would have forgotten. My suggestion would be to create a private function which has this parameter but leave this interface as it is, e.g.

def compile_legacy_sources(self, resources, inc_dirs=None, exclude_paths=None)
    return _compile_sources(resources, inc_dirs=inc_dirs, exclude_paths=exclude_paths)

def compile_sources(self, resources, inc_dirs=None)
    return _compile_sources(resources, inc_dirs=inc_dirs)

def _compile_sources(self, resources, inc_dirs=None, exclude_paths=None)
    ...

I would also ask whether there is a different between dirs and paths the two different terminologies in the parameter list might be confusing.

# Web IDE progress bar for project build
files_to_compile = (
resources.get_file_refs(FileType.ASM_SRC) +
resources.get_file_refs(FileType.C_SRC) +
resources.get_file_refs(FileType.CPP_SRC)
)
self.to_be_compiled = len(files_to_compile)
# Remove files from paths to be excluded from the build and create
# a compilation queue.
compile_queue = (
files_to_compile
if not exclude_paths
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the ternary operator here makes the code more difficult to read, a simple if then else would be clearer IMO.

else [
file_to_compile
for exclude_path in exclude_paths
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this list comprehension does what you want. It works ok when there is a single exclude path, but when there are multiple exclude paths the file to compile with be included once for every exclude path.

I don't think it would be a bad idea to break out this functionality into a small function and unit test.

Copy link
Contributor

Choose a reason for hiding this comment

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

The scope of this change is to provide a short-term workaround to maintain Mbed OS 2 compatibility until legacy build support is removed.
If the current code works when there is a single exclude path then let's add a comment to that effect and let's convert exclude_paths to a single exclude_path.

for file_to_compile in files_to_compile
if exclude_path not in file_to_compile.path
]
)

self.to_be_compiled = len(compile_queue)
self.compiled = 0

self.notify.cc_verbose("Macros: " + ' '.join([
Expand Down Expand Up @@ -434,8 +447,8 @@ def compile_sources(self, resources, inc_dirs=None):
self.dump_build_profile()

# Sort compile queue for consistency
files_to_compile.sort()
for source in files_to_compile:
compile_queue.sort()
for source in compile_queue:
object = self.relative_object_path(self.build_dir, source)

# Queue mode (multiprocessing)
Expand Down