Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/nos3#275' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jlucas9 committed May 15, 2024
2 parents 5382e50 + 34260dd commit bf8dd3d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 19 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions fsw/platform_inc/sample_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion fsw/src/sample_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions sim/src/sample_data_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Sim42DataPoint> dp) : _dp(*dp), _sc(spacecraft)
Expand Down
3 changes: 1 addition & 2 deletions sim/src/sample_hardware_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
10 changes: 3 additions & 7 deletions support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
4 changes: 2 additions & 2 deletions support/device_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf8dd3d

Please sign in to comment.