Merge pull request #11683 from AnttiKauppila/baremetal_support

Baremetal profile fixes
pull/11810/head
Martin Kojtal 2019-11-04 15:53:57 +01:00 committed by GitHub
commit fe940924cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 6 deletions

View File

@ -43,5 +43,5 @@ set(unittest-test-sources
) )
# defines # defines
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") 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")
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") 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")

View File

@ -50,9 +50,12 @@ const int DEVICE_READY = 0x04;
namespace mbed { namespace mbed {
CellularStateMachine::CellularStateMachine(CellularDevice &device, events::EventQueue &queue, CellularNetwork &nw) : CellularStateMachine::CellularStateMachine(CellularDevice &device, events::EventQueue &queue, CellularNetwork &nw) :
#ifdef MBED_CONF_RTOS_PRESENT
_queue_thread(0),
#endif
_cellularDevice(device), _state(STATE_INIT), _next_state(_state), _target_state(_state), _cellularDevice(device), _state(STATE_INIT), _next_state(_state), _target_state(_state),
_event_status_cb(0), _network(nw), _queue(queue), _queue_thread(0), _sim_pin(0), _event_status_cb(0), _network(nw), _queue(queue), _sim_pin(0), _retry_count(0),
_retry_count(0), _event_timeout(-1), _event_id(-1), _plmn(0), _command_success(false), _event_timeout(-1), _event_id(-1), _plmn(0), _command_success(false),
_is_retry(false), _cb_data(), _current_event(CellularDeviceReady), _status(0) _is_retry(false), _cb_data(), _current_event(CellularDeviceReady), _status(0)
{ {
#if MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY == 0 #if MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY == 0
@ -102,11 +105,13 @@ void CellularStateMachine::reset()
void CellularStateMachine::stop() void CellularStateMachine::stop()
{ {
tr_debug("CellularStateMachine stop"); tr_debug("CellularStateMachine stop");
#ifdef MBED_CONF_RTOS_PRESENT
if (_queue_thread) { if (_queue_thread) {
_queue_thread->terminate(); _queue_thread->terminate();
delete _queue_thread; delete _queue_thread;
_queue_thread = NULL; _queue_thread = NULL;
} }
#endif
reset(); reset();
_event_id = STM_STOPPED; _event_id = STM_STOPPED;
@ -635,6 +640,7 @@ void CellularStateMachine::event()
nsapi_error_t CellularStateMachine::start_dispatch() nsapi_error_t CellularStateMachine::start_dispatch()
{ {
#ifdef MBED_CONF_RTOS_PRESENT
if (!_queue_thread) { if (!_queue_thread) {
_queue_thread = new rtos::Thread(osPriorityNormal, 2048, NULL, "stm_queue"); _queue_thread = new rtos::Thread(osPriorityNormal, 2048, NULL, "stm_queue");
_event_id = STM_STOPPED; _event_id = STM_STOPPED;
@ -649,7 +655,7 @@ nsapi_error_t CellularStateMachine::start_dispatch()
} }
_event_id = -1; _event_id = -1;
#endif
return NSAPI_ERROR_OK; return NSAPI_ERROR_OK;
} }

View File

@ -22,9 +22,11 @@
#include "CellularCommon.h" #include "CellularCommon.h"
#include "PlatformMutex.h" #include "PlatformMutex.h"
#ifdef MBED_CONF_RTOS_PRESENT
namespace rtos { namespace rtos {
class Thread; class Thread;
} }
#endif
namespace mbed { namespace mbed {
@ -159,6 +161,12 @@ private:
void send_event_cb(cellular_connection_status_t status); void send_event_cb(cellular_connection_status_t status);
void change_timeout(const int &timeout); void change_timeout(const int &timeout);
private:
#ifdef MBED_CONF_RTOS_PRESENT
rtos::Thread *_queue_thread;
#endif
CellularDevice &_cellularDevice; CellularDevice &_cellularDevice;
CellularState _state; CellularState _state;
CellularState _next_state; CellularState _next_state;
@ -168,7 +176,6 @@ private:
CellularNetwork &_network; CellularNetwork &_network;
events::EventQueue &_queue; events::EventQueue &_queue;
rtos::Thread *_queue_thread;
const char *_sim_pin; const char *_sim_pin;
int _retry_count; int _retry_count;

View File

@ -16,6 +16,8 @@
*/ */
#include "L3IPInterface.h" #include "L3IPInterface.h"
#if MBED_CONF_LWIP_L3IP_ENABLED
#include "LWIPStack.h" #include "LWIPStack.h"
using namespace mbed; using namespace mbed;
@ -157,3 +159,5 @@ nsapi_error_t L3IPInterface::set_blocking(bool blocking)
_blocking = blocking; _blocking = blocking;
return NSAPI_ERROR_OK; return NSAPI_ERROR_OK;
} }
#endif