Skip to content

UBLOX_EVK_ODIN_W2: Fix baremetal build and greentea tests #11881

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions features/FEATURE_BLE/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ble",
"config": {
"present": 1,
"ble-role-observer": {
"help": "Include observer BLE role support (scanning for and processing advertising packets).",
"value": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !MBED_CONF_BLE_PRESENT
#error [NOT_SUPPORTED] BLE cordio test cases require the BLE library.
#else

#include <stdio.h>

Expand Down Expand Up @@ -109,3 +112,5 @@ Specification specification(greentea_test_setup, cases, greentea_test_teardown_h
int main() {
return !Harness::run(specification);
}

#endif // !MBED_CONF_BLE_PRESENT
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
* limitations under the License.
*/

#if !MBED_CONF_BLE_PRESENT
#error [NOT_SUPPORTED] BLE cordio test cases require the BLE library.
#else

#include <stdio.h>
#include <algorithm>

Expand Down Expand Up @@ -265,3 +269,5 @@ int main()
return !Harness::run(specification);
}
#endif // CORDIO_ZERO_COPY_HCI

#endif //!MBED_CONF_BLE_PRESENT
1 change: 1 addition & 0 deletions features/lwipstack/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "lwip",
"config": {
"present": 1,
Copy link
Member

Choose a reason for hiding this comment

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

What does this change exactly?

Copy link
Collaborator Author

@hugueskamba hugueskamba Nov 21, 2019

Choose a reason for hiding this comment

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

It creates #define MBED_CONF_LWIP_PRESENT 1.
If a build includes the lwIP library it will define that macro and thus will compile in the code that is gated with #if MBED_CONF_LWIP_PRESENT. It was added so it can be excluded for baremetal builds when the liibrary is not included.

In summary, without this non-baremetal builds will always fail if the build relies on lwIP.

We cannot use FEATURE_LWIP because it is always defined for a given target that supports LWIP.

FEATURE_LWIP = target supports the lwIP feature
MBED_CONF_LWIP_PRESENT = the lwIP lib is included in the build

"ipv4-enabled": {
"help": "Enable IPv4",
"value": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

#if MBED_CONF_LWIP_PRESENT

#include "OdinWiFiInterface.h"
#include "cb_main.h"
#include "cb_wlan.h"
Expand Down Expand Up @@ -2107,3 +2109,4 @@ static cbTARGET_PowerSaveMode convertPowerSaveAtToIoctl(target_power_save_mode_e
return mode;
}

#endif // MBED_CONF_LWIP_PRESENT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ODIN-W2 implementation of WiFiInterface
* Copyright (c) 2016 u-blox Malm� AB
* Copyright (c) 2016 u-blox Malm� AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,8 @@
#ifndef ODIN_WIFI_INTERFACE_H
#define ODIN_WIFI_INTERFACE_H

#if MBED_CONF_LWIP_PRESENT

#include "WiFiInterface.h"
#if DEVICE_WIFI_AP
#include "UbloxWiFiSoftAPInterface.h"
Expand Down Expand Up @@ -443,3 +445,5 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
};

#endif

#endif // MBED_CONF_LWIP_PRESENT
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
* limitations under the License.
*/

#ifdef MBED_CONF_LWIP_PRESENT

#include "OdinWiFiInterface.h"

WiFiInterface *WiFiInterface::get_target_default_instance()
{
static OdinWiFiInterface wifi;
return &wifi;
}

#endif // MBED_CONF_LWIP_PRESENT