From d9cb819179f07594be5b46adf4274fd0bbebfdd5 Mon Sep 17 00:00:00 2001 From: strahi-linux Date: Wed, 3 Jul 2024 08:10:01 +0200 Subject: [PATCH] Added forgotten deploy folder for SDK testing --- deploy/CMakeLists.txt | 2 + .../static_naming_convention_f/CMakeLists.txt | 35 +++++++ deploy/static_naming_convention_f/ReadMe.txt | 15 +++ deploy/static_naming_convention_f/main.c | 97 +++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 deploy/CMakeLists.txt create mode 100644 deploy/static_naming_convention_f/CMakeLists.txt create mode 100644 deploy/static_naming_convention_f/ReadMe.txt create mode 100644 deploy/static_naming_convention_f/main.c diff --git a/deploy/CMakeLists.txt b/deploy/CMakeLists.txt new file mode 100644 index 000000000..0a387894a --- /dev/null +++ b/deploy/CMakeLists.txt @@ -0,0 +1,2 @@ +## ./deploy/CMakeLists.txt +add_subdirectory(static_naming_convention_f) diff --git a/deploy/static_naming_convention_f/CMakeLists.txt b/deploy/static_naming_convention_f/CMakeLists.txt new file mode 100644 index 000000000..27c873727 --- /dev/null +++ b/deploy/static_naming_convention_f/CMakeLists.txt @@ -0,0 +1,35 @@ +## ./deploy/static_naming_convention_f/CMakeLists.txt +include(utils) + +add_executable(static_naming_convention_f + main.c + ReadMe.txt +) + +set(package_list "") +set(module_list "") + +## TODO - add new modules as implemented +find_include_package(package_list module_list MikroSDK.Driver.ADC) +find_include_package(package_list module_list MikroSDK.Driver.GPIO.In) +find_include_package(package_list module_list MikroSDK.Driver.GPIO.Out) +find_include_package(package_list module_list MikroSDK.Driver.GPIO.Port) +find_include_package(package_list module_list MikroSDK.Driver.I2C.Master) +find_include_package(package_list module_list MikroSDK.Driver.PWM) +find_include_package(package_list module_list MikroSDK.Driver.SPI.Master) +find_include_package(package_list module_list MikroSDK.Driver.UART) +find_include_package(package_list module_list MikroSDK.Driver.OneWire) +find_include_package(package_list module_list MikroSDK.Driver.CAN) +find_include_package(package_list module_list MikroSDK.Driver.DMA) +find_include_package(package_list module_list MikroSDK.Driver.RTC) + +target_link_libraries(static_naming_convention_f + PUBLIC + MikroC.Core + ${package_list} +) + +target_compile_definitions(static_naming_convention_f + PUBLIC + ${module_list} +) diff --git a/deploy/static_naming_convention_f/ReadMe.txt b/deploy/static_naming_convention_f/ReadMe.txt new file mode 100644 index 000000000..58a0a2c6f --- /dev/null +++ b/deploy/static_naming_convention_f/ReadMe.txt @@ -0,0 +1,15 @@ +Example is meant for testing if all modules build together. + +This has been noticed on XC8 compilers for a specific case: + ++ All modules have same function names (hal_ll_get_specifics) ++ When two or more modules are used, the compiler can not find appropriate reference to function + +We shall run this test on all compilers just in case. + +TODOs in code if new modules are added: + ++ ./deploy/static_naming_convention_f/CMakeLists.txt + + Call find_include_package(package_list module_list TODO_NEW_PACKAGE_NAME) ++ ./deploy/static_naming_convention_f/main.c + + Ifdef new module header include and function call diff --git a/deploy/static_naming_convention_f/main.c b/deploy/static_naming_convention_f/main.c new file mode 100644 index 000000000..9a8ab94ac --- /dev/null +++ b/deploy/static_naming_convention_f/main.c @@ -0,0 +1,97 @@ +// ------------------------------------------------------------------ INCLUDES + +/** + * Any initialization code needed for MCU to function properly. + * Do not remove this line or clock might not be set correctly. + */ +#ifdef PREINIT_SUPPORTED +#include "preinit.h" +#endif + +#ifdef MikroSDKDriverADC +#include "drv_analog_in.h" +#endif +#ifdef MikroSDKDriverI2CMaster +#include "drv_i2c_master.h" +#endif +#ifdef MikroSDKDriverDMA +#include "drv_dma.h" +#endif +#ifdef MikroSDKDriverOneWire +#include "drv_one_wire.h" +#endif +#ifdef MikroSDKDriverUART +#include "drv_uart.h" +#endif +#ifdef MikroSDKDriverSPIMaster +#include "drv_spi_master.h" +#endif +#ifdef MikroSDKDriverPWM +#include "drv_pwm.h" +#endif +#ifdef MikroSDKDriverGPIOPort +#include "drv_port.h" +#endif +#ifdef MikroSDKDriverGPIOOut +#include "drv_digital_out.h" +#endif +#ifdef MikroSDKDriverGPIOIn +#include "drv_digital_in.h" +#endif +#ifdef MikroSDKDriverCAN +#include "drv_can.h" +#endif +#ifdef MikroSDKDriverRTC +#include "drv_rtc.h" +#endif + +// ----------------------------------------------------------------- USER CODE +int main( void ) { + /* Do not remove this line or clock might not be set correctly. */ + #ifdef PREINIT_SUPPORTED + preinit(); + #endif + + #ifdef MikroSDKDriverADC + analog_in_set_resolution((void *)0, 0); + #endif + #ifdef MikroSDKDriverI2CMaster + i2c_master_set_speed((void *)0, 0); + #endif + #ifdef MikroSDKDriverDMA + dma_transfer_start((void *)0); + #endif + #ifdef MikroSDKDriverOneWire + one_wire_search_first_device((void *)0, 0); + #endif + #ifdef MikroSDKDriverUART + uart_set_baud((void *)0, 0); + #endif + #ifdef MikroSDKDriverSPIMaster + spi_master_set_speed((void *)0, 0); + #endif + #ifdef MikroSDKDriverPWM + pwm_set_freq((void *)0, 0); + #endif + #ifdef MikroSDKDriverGPIOPort + port_write((void *)0, 0); + #endif + #ifdef MikroSDKDriverGPIOOut + digital_out_toggle((void *)0); + #endif + #ifdef MikroSDKDriverGPIOIn + digital_in_read((void *)0); + #endif + #ifdef MikroSDKDriverCAN + can_transmit((void *)0, (void *)0); + #endif + #ifdef MikroSDKDriverRTC + rtc_set_time((void *)0); + #endif + + while(1); + + return 0; +} + +// ----------------------------------------------------------------------- END