Skip to content

Commit

Permalink
Added forgotten deploy folder for SDK testing
Browse files Browse the repository at this point in the history
  • Loading branch information
StrahinjaJacimovic committed Jul 3, 2024
1 parent 10813f9 commit d9cb819
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deploy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## ./deploy/CMakeLists.txt
add_subdirectory(static_naming_convention_f)
35 changes: 35 additions & 0 deletions deploy/static_naming_convention_f/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
)
15 changes: 15 additions & 0 deletions deploy/static_naming_convention_f/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -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
97 changes: 97 additions & 0 deletions deploy/static_naming_convention_f/main.c
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d9cb819

Please sign in to comment.