-
Notifications
You must be signed in to change notification settings - Fork 38
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
Task 3, libSMCE console #51
base: master
Are you sure you want to change the base?
Changes from all commits
cbffdf6
95a9a9e
ed37707
7da05fd
af112b4
023a2ae
4bed0b0
ecdb59f
84390c5
b5d3520
68eb00b
2f26c6f
b957ff5
b2ba11c
117473b
79ed7ca
2a29d24
100b84e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ target_sources (HostUDD PRIVATE | |
) | ||
|
||
|
||
add_library (objSMCE OBJECT) | ||
add_library (objSMCE OBJECT ) | ||
configure_coverage (objSMCE) | ||
set_property (TARGET objSMCE PROPERTY CXX_EXTENSIONS Off) | ||
set_property (TARGET objSMCE PROPERTY POSITION_INDEPENDENT_CODE True) | ||
|
@@ -153,6 +153,7 @@ target_sources (objSMCE PRIVATE | |
include/SMCE/SketchConf.hpp | ||
include/SMCE/internal/BoardDeviceSpecification.hpp | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Superfluous change |
||
if (NOT MSVC) | ||
target_compile_options (objSMCE PRIVATE "-Wall" "-Wextra" "-Wpedantic" "-Werror" "-Wcast-align") | ||
else () | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# client/CMakeLists.txt | ||
# Written by Rylander and Mejborn, Team 1, DAT265. | ||
# | ||
# | ||
|
||
|
||
cmake_minimum_required (VERSION 3.16) | ||
project (SMCE_client) | ||
|
||
find_package (Threads REQUIRED) | ||
find_package (SMCE REQUIRED) | ||
|
||
set (SMCE_RES "${PROJECT_BINARY_DIR}/SMCE_Res") | ||
|
||
include (FetchContent) | ||
FetchContent_Declare (Termcolor | ||
GIT_REPOSITORY "https://github.com/ikalnytskyi/termcolor" | ||
GIT_TAG "v2.0.0" | ||
GIT_SHALLOW On | ||
GIT_PROGRESS On | ||
) | ||
FetchContent_Declare (Lyra | ||
GIT_REPOSITORY "https://github.com/bfgroup/Lyra" | ||
GIT_TAG "1.5.1" | ||
GIT_SHALLOW On | ||
GIT_PROGRESS On | ||
) | ||
FetchContent_MakeAvailable(Termcolor Lyra) | ||
|
||
add_executable (${PROJECT_NAME} SMCE_Client.cpp) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/src) | ||
target_sources (${PROJECT_NAME} PRIVATE | ||
src/UartToFile.hpp | ||
src/UartToFile.cpp | ||
) | ||
target_link_libraries (${PROJECT_NAME} PRIVATE SMCE::SMCE termcolor::termcolor bfg::Lyra) | ||
target_include_directories (${PROJECT_NAME} PUBLIC | ||
"${termcolor_SOURCE_DIR}/include/termcolor" | ||
"${lyra_SOURCE_DIR}/include/lyra" | ||
) | ||
Comment on lines
+38
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would be incredibly surprised that the |
||
target_compile_definitions (${PROJECT_NAME} PRIVATE "SMCE_RESOURCES_DIR=\"${SMCE_RES}\"") | ||
file (MAKE_DIRECTORY "${SMCE_RES}") | ||
execute_process (COMMAND "${CMAKE_COMMAND}" -E tar xf "${SMCE_RESOURCES_ARK}" | ||
WORKING_DIRECTORY "${SMCE_RES}") | ||
|
||
add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD | ||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:SMCE::SMCE>" "$<TARGET_FILE_DIR:SMCE_client>" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# libSMCE command line frontend | ||
|
||
Like SMCE, this command line frontend requires a C++20 toolchain. | ||
|
||
**IMPORTANT** | ||
As is, SMCE_Client is not guaranteed to work on Windows machines! | ||
Due to a bug that causes the running sketch to crash when sending or reciving messages on uart. | ||
|
||
|
||
## Build instructions | ||
|
||
```shell | ||
cd client | ||
cmake -S . -B build/ | ||
cmake --build build/ | ||
``` | ||
|
||
You can now find the executable "SMCE_client" in the `./build` directory. | ||
|
||
## Run instructions | ||
``` | ||
SMCE_client -f <fqbn> -p <path_to_sketch> | ||
``` | ||
where | ||
- FQBN: [Fully Qualified Board Name](https://arduino.github.io/arduino-cli/latest/FAQ/#whats-the-fqbn-string) | ||
Testing has been done with fqbn = arduino:sam:arduino_due_x | ||
- Sketch path: Relative or absolute path to the sketch to run | ||
|
||
### Start arguments | ||
-f,--fqbn <fqbn> -> <fqbn> = Fully qualified board name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a note in general, fqbn is basically deprecated, so I would default this parameter |
||
-p,--path <path_to_sketch> -> <path_to_sketch> = Relative or absolute path to the sketch to run | ||
-d,--dir <arduino_root_dir> -> <arduino_root_dir> = Relative or absolute path to desired location of arduino root folder | ||
-s,--SMCE <smce_resource_dir> -> <smce_resource_dir> = Relative or absolute path to SMCE\_RESOURCE folder | ||
-u,--file <write_to_file> -> <write_to_file> = Set to true if uart should write to file (created in the set arduino root folder) | ||
|
||
(-s or -- SMCE, can be used if binary is not compiled and already linked to the SMCE_RESOURCE folder for the current computer.) | ||
|
||
## Configuration of board | ||
|
||
As is, configuring of GPIO pins on the board is done in the source file SMCE_Client.cpp, as seen here: | ||
|
||
``` | ||
smce::BoardConfig board_conf{ | ||
.pins = {0,1}, | ||
.gpio_drivers = { | ||
smce::BoardConfig::GpioDrivers{0, | ||
smce::BoardConfig::GpioDrivers::DigitalDriver{true,true}, | ||
smce::BoardConfig::GpioDrivers::AnalogDriver{false,false} | ||
}, | ||
... | ||
... | ||
} | ||
``` | ||
.pins = a list of all a pins on the board. | ||
.gpio_drivers = specifies the drivers for each pin, configured as: | ||
``` | ||
smce::BoardConfig::GpioDrivers{<pin>, | ||
smce::BoardConfig::GpioDrivers::DigitalDriver{<read>,<write>}, | ||
smce::BoardConfig::GpioDrivers::AnalogDriver{<read>,<write>} | ||
} | ||
``` | ||
DigitalDriver and AnalogDriver has two parameters {<read>,<write>}, these are set as true or false depending on what the pin should be able to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superfluous change