Skip to content

Commit fe94092

Browse files
authored
Merge pull request #11683 from AnttiKauppila/baremetal_support
Baremetal profile fixes
2 parents 412b0ae + ac0b0f1 commit fe94092

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

UNITTESTS/features/cellular/framework/device/cellularstatemachine/unittest.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ set(unittest-test-sources
4343
)
4444

4545
# defines
46-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1")
47-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1")
46+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1 -DMBED_CONF_RTOS_PRESENT=1")
47+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1 -DMBED_CONF_RTOS_PRESENT=1")

features/cellular/framework/device/CellularStateMachine.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ const int DEVICE_READY = 0x04;
5050
namespace mbed {
5151

5252
CellularStateMachine::CellularStateMachine(CellularDevice &device, events::EventQueue &queue, CellularNetwork &nw) :
53+
#ifdef MBED_CONF_RTOS_PRESENT
54+
_queue_thread(0),
55+
#endif
5356
_cellularDevice(device), _state(STATE_INIT), _next_state(_state), _target_state(_state),
54-
_event_status_cb(0), _network(nw), _queue(queue), _queue_thread(0), _sim_pin(0),
55-
_retry_count(0), _event_timeout(-1), _event_id(-1), _plmn(0), _command_success(false),
57+
_event_status_cb(0), _network(nw), _queue(queue), _sim_pin(0), _retry_count(0),
58+
_event_timeout(-1), _event_id(-1), _plmn(0), _command_success(false),
5659
_is_retry(false), _cb_data(), _current_event(CellularDeviceReady), _status(0)
5760
{
5861
#if MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY == 0
@@ -102,11 +105,13 @@ void CellularStateMachine::reset()
102105
void CellularStateMachine::stop()
103106
{
104107
tr_debug("CellularStateMachine stop");
108+
#ifdef MBED_CONF_RTOS_PRESENT
105109
if (_queue_thread) {
106110
_queue_thread->terminate();
107111
delete _queue_thread;
108112
_queue_thread = NULL;
109113
}
114+
#endif
110115

111116
reset();
112117
_event_id = STM_STOPPED;
@@ -635,6 +640,7 @@ void CellularStateMachine::event()
635640

636641
nsapi_error_t CellularStateMachine::start_dispatch()
637642
{
643+
#ifdef MBED_CONF_RTOS_PRESENT
638644
if (!_queue_thread) {
639645
_queue_thread = new rtos::Thread(osPriorityNormal, 2048, NULL, "stm_queue");
640646
_event_id = STM_STOPPED;
@@ -649,7 +655,7 @@ nsapi_error_t CellularStateMachine::start_dispatch()
649655
}
650656

651657
_event_id = -1;
652-
658+
#endif
653659
return NSAPI_ERROR_OK;
654660
}
655661

features/cellular/framework/device/CellularStateMachine.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
#include "CellularCommon.h"
2323
#include "PlatformMutex.h"
2424

25+
#ifdef MBED_CONF_RTOS_PRESENT
2526
namespace rtos {
2627
class Thread;
2728
}
29+
#endif
2830

2931
namespace mbed {
3032

@@ -159,6 +161,12 @@ class CellularStateMachine {
159161
void send_event_cb(cellular_connection_status_t status);
160162
void change_timeout(const int &timeout);
161163

164+
private:
165+
166+
#ifdef MBED_CONF_RTOS_PRESENT
167+
rtos::Thread *_queue_thread;
168+
#endif
169+
162170
CellularDevice &_cellularDevice;
163171
CellularState _state;
164172
CellularState _next_state;
@@ -168,7 +176,6 @@ class CellularStateMachine {
168176

169177
CellularNetwork &_network;
170178
events::EventQueue &_queue;
171-
rtos::Thread *_queue_thread;
172179

173180
const char *_sim_pin;
174181
int _retry_count;

features/netsocket/L3IPInterface.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717

1818
#include "L3IPInterface.h"
19+
20+
#if MBED_CONF_LWIP_L3IP_ENABLED
1921
#include "LWIPStack.h"
2022
using namespace mbed;
2123

@@ -157,3 +159,5 @@ nsapi_error_t L3IPInterface::set_blocking(bool blocking)
157159
_blocking = blocking;
158160
return NSAPI_ERROR_OK;
159161
}
162+
163+
#endif

0 commit comments

Comments
 (0)