diff --git a/README.md b/README.md index f6885c8..1ffc1e7 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,23 @@ Optionally the 42 data provider can be configured in the `nos3-simulator.xml`: ``` +# Standalone +To build the standalone version, assuming starting from top level NOS3 repository: +* make debug +* cd ./components/sample/support +* mkdir build +* cd build +* cmake .. + * Can override target selection by adding `-DTGTNAME=cpu1` +* make + +To run the standalone version, assuming starting rom the top level NOS3 repository: +* Follow the build steps above +* make +* make checkout + * Launches NOS Engine, NOS Time Driver, NOS Terminal, Sample Sim, and Sample Checkout +* make stop + # Documentation If this sample application had an ICD and/or test procedure, they would be linked here. diff --git a/fsw/platform_inc/sample_platform_cfg.h b/fsw/platform_inc/sample_platform_cfg.h index 723e2c1..1cfb131 100644 --- a/fsw/platform_inc/sample_platform_cfg.h +++ b/fsw/platform_inc/sample_platform_cfg.h @@ -18,8 +18,8 @@ /* Notes: ** NOS3 uart requires matching handle and bus number */ - #define SAMPLE_CFG_STRING "usart_29" - #define SAMPLE_CFG_HANDLE 29 + #define SAMPLE_CFG_STRING "usart_16" + #define SAMPLE_CFG_HANDLE 16 #define SAMPLE_CFG_BAUDRATE_HZ 115200 #define SAMPLE_CFG_MS_TIMEOUT 50 /* Max 255 */ /* Note: Debug flag disabled (commented out) by default */ diff --git a/fsw/src/sample_app.c b/fsw/src/sample_app.c index fa06abc..f6f3405 100644 --- a/fsw/src/sample_app.c +++ b/fsw/src/sample_app.c @@ -356,7 +356,6 @@ void SAMPLE_ProcessGroundCommand(void) */ void SAMPLE_ProcessTelemetryRequest(void) { - int32 status = OS_SUCCESS; CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; diff --git a/fsw/src/sample_device.c b/fsw/src/sample_device.c index 881ee68..04e79ea 100644 --- a/fsw/src/sample_device.c +++ b/fsw/src/sample_device.c @@ -248,7 +248,7 @@ int32_t SAMPLE_RequestData(uart_info_t* device, SAMPLE_Device_Data_tlm_t* data) #ifdef SAMPLE_CFG_DEBUG OS_printf(" Header = 0x%02x%02x \n", read_data[0], read_data[1]); - OS_printf(" Counter = 0x%08x \n", data->DeviceCounter); + OS_printf(" Counter = 0x%08x, %d \n", data->DeviceCounter, data->DeviceCounter); OS_printf(" Data X = 0x%04x, %d \n", data->DeviceDataX, data->DeviceDataX); OS_printf(" Data Y = 0x%04x, %d \n", data->DeviceDataY, data->DeviceDataY); OS_printf(" Data Z = 0x%04x, %d \n", data->DeviceDataZ, data->DeviceDataZ); diff --git a/sim/src/sample_data_point.cpp b/sim/src/sample_data_point.cpp index 465cef0..bbc2fc8 100644 --- a/sim/src/sample_data_point.cpp +++ b/sim/src/sample_data_point.cpp @@ -9,12 +9,12 @@ namespace Nos3 { sim_logger->trace("SampleDataPoint::SampleDataPoint: Defined Constructor executed"); - /* Do calculations based on provided data */ + /* Do calculations based on provided data - also preparing like ADC data to checkout is obvious */ _42_parsing = false; _sample_data_is_valid = true; - _sample_data[0] = count * 0.001; - _sample_data[1] = count * 0.002; - _sample_data[2] = count * 0.003; + _sample_data[0] = (((count * 1) / 32767.0) - 32768.0); + _sample_data[1] = (((count * 2) / 32767.0) - 32768.0); + _sample_data[2] = (((count * 3) / 32767.0) - 32768.0); } SampleDataPoint::SampleDataPoint(int16_t spacecraft, const boost::shared_ptr dp) : _dp(*dp), _sc(spacecraft) diff --git a/sim/src/sample_hardware_model.cpp b/sim/src/sample_hardware_model.cpp index e61a412..8e78b45 100644 --- a/sim/src/sample_hardware_model.cpp +++ b/sim/src/sample_hardware_model.cpp @@ -308,10 +308,9 @@ namespace Nos3 } } - /* Increment count and echo command since format valid */ + /* Echo command since format valid */ if (valid == SAMPLE_SIM_SUCCESS) { - _count++; _uart_connection->write(&in_data[0], in_data.size()); /* Send response if existing */ diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index f62b268..fa80fe6 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -3,12 +3,8 @@ cmake_minimum_required(VERSION 2.6.4) project (sample_checkout) if (NOT DEFINED TGTNAME) - message(FATAL_ERROR "TGTNAME must be defined on the cmake command line (e.g. \"-DTGTNAME=cpu1\")") -endif() - -if(${TGTNAME} STREQUAL cpu1) - SET(CMAKE_C_FLAGS_INIT "-m32" CACHE STRING "C Flags required by platform") - SET(CMAKE_C_FLAGS "-m32" CACHE STRING "C Flags required by platform") + set(TGTNAME "cpu1") + message(STATUS "Selecting cpu1 for build, can override with \"-DTGTNAME=cpu1\"") endif() include(../../ComponentSettings.cmake) @@ -65,5 +61,5 @@ add_executable(sample_checkout ${sample_checkout_src}) target_link_libraries(sample_checkout ${sample_checkout_libs}) if(${TGTNAME} STREQUAL cpu1) - set_target_properties(sample_checkout PROPERTIES COMPILE_FLAGS "-m32 -g" LINK_FLAGS "-m32 -g") + set_target_properties(sample_checkout PROPERTIES COMPILE_FLAGS "-g" LINK_FLAGS "-g") endif() diff --git a/support/device_cfg.h b/support/device_cfg.h index c28634d..92234ca 100644 --- a/support/device_cfg.h +++ b/support/device_cfg.h @@ -6,8 +6,8 @@ */ #define SAMPLE_CFG /* Note: NOS3 uart requires matching handle and bus number */ -#define SAMPLE_CFG_STRING "/dev/usart_29" -#define SAMPLE_CFG_HANDLE 29 +#define SAMPLE_CFG_STRING "/dev/usart_16" +#define SAMPLE_CFG_HANDLE 16 #define SAMPLE_CFG_BAUDRATE_HZ 115200 #define SAMPLE_CFG_MS_TIMEOUT 250 #define SAMPLE_CFG_DEBUG