Skip to content

Baremetal profile fixes #11683

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 2 commits into from
Nov 4, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ set(unittest-test-sources
)

# 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_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_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 -DMBED_CONF_RTOS_PRESENT=1")
12 changes: 9 additions & 3 deletions features/cellular/framework/device/CellularStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ const int DEVICE_READY = 0x04;
namespace mbed {

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),
_event_status_cb(0), _network(nw), _queue(queue), _queue_thread(0), _sim_pin(0),
_retry_count(0), _event_timeout(-1), _event_id(-1), _plmn(0), _command_success(false),
_event_status_cb(0), _network(nw), _queue(queue), _sim_pin(0), _retry_count(0),
_event_timeout(-1), _event_id(-1), _plmn(0), _command_success(false),
_is_retry(false), _cb_data(), _current_event(CellularDeviceReady), _status(0)
{
#if MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY == 0
Expand Down Expand Up @@ -102,11 +105,13 @@ void CellularStateMachine::reset()
void CellularStateMachine::stop()
{
tr_debug("CellularStateMachine stop");
#ifdef MBED_CONF_RTOS_PRESENT
if (_queue_thread) {
_queue_thread->terminate();
delete _queue_thread;
_queue_thread = NULL;
}
#endif

reset();
_event_id = STM_STOPPED;
Expand Down Expand Up @@ -635,6 +640,7 @@ void CellularStateMachine::event()

nsapi_error_t CellularStateMachine::start_dispatch()
{
#ifdef MBED_CONF_RTOS_PRESENT
if (!_queue_thread) {
_queue_thread = new rtos::Thread(osPriorityNormal, 2048, NULL, "stm_queue");
_event_id = STM_STOPPED;
Expand All @@ -649,7 +655,7 @@ nsapi_error_t CellularStateMachine::start_dispatch()
}

_event_id = -1;

#endif
return NSAPI_ERROR_OK;
}

Expand Down
9 changes: 8 additions & 1 deletion features/cellular/framework/device/CellularStateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
#include "CellularCommon.h"
#include "PlatformMutex.h"

#ifdef MBED_CONF_RTOS_PRESENT
namespace rtos {
class Thread;
}
#endif

namespace mbed {

Expand Down Expand Up @@ -159,6 +161,12 @@ class CellularStateMachine {
void send_event_cb(cellular_connection_status_t status);
void change_timeout(const int &timeout);

private:

#ifdef MBED_CONF_RTOS_PRESENT
rtos::Thread *_queue_thread;
#endif

CellularDevice &_cellularDevice;
CellularState _state;
CellularState _next_state;
Expand All @@ -168,7 +176,6 @@ class CellularStateMachine {

CellularNetwork &_network;
events::EventQueue &_queue;
rtos::Thread *_queue_thread;

const char *_sim_pin;
int _retry_count;
Expand Down
4 changes: 4 additions & 0 deletions features/netsocket/L3IPInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/

#include "L3IPInterface.h"

#if MBED_CONF_LWIP_L3IP_ENABLED
#include "LWIPStack.h"
using namespace mbed;

Expand Down Expand Up @@ -157,3 +159,5 @@ nsapi_error_t L3IPInterface::set_blocking(bool blocking)
_blocking = blocking;
return NSAPI_ERROR_OK;
}

#endif