From 2642e490ae98d6e9695c82b2ccd6c4f537f80784 Mon Sep 17 00:00:00 2001 From: Nanosonde <2073569+nanosonde@users.noreply.github.com> Date: Thu, 22 Oct 2020 17:37:17 +0200 Subject: [PATCH] Move CC1310 platform init around --- .gitignore | 4 +++- examples/knx-cc1310/knx_wrapper.cpp | 2 +- examples/knx-cc1310/main_nortos.c | 7 ------- src/cc1310_platform.cpp | 8 +++++++- src/cc1310_platform.h | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index c2a029f..24e736d 100644 --- a/.gitignore +++ b/.gitignore @@ -275,4 +275,6 @@ doc/build .vscode/.browse.c_cpp.db* .vscode/c_cpp_properties.json .vscode/launch.json -.vscode/ipch \ No newline at end of file +.vscode/ipch +.vscode/.cortex-debug.registers.state.json +.vscode/.cortex-debug.peripherals.state.json diff --git a/examples/knx-cc1310/knx_wrapper.cpp b/examples/knx-cc1310/knx_wrapper.cpp index 9e81c27..a5dbfd1 100644 --- a/examples/knx-cc1310/knx_wrapper.cpp +++ b/examples/knx-cc1310/knx_wrapper.cpp @@ -10,7 +10,7 @@ void setup() pKnx = new KnxFacade; KnxFacade &knx = *pKnx; - knx.platform().earlyInit(); + knx.platform().init(); knx.readMemory(); diff --git a/examples/knx-cc1310/main_nortos.c b/examples/knx-cc1310/main_nortos.c index 4f04ed7..e99a060 100644 --- a/examples/knx-cc1310/main_nortos.c +++ b/examples/knx-cc1310/main_nortos.c @@ -107,13 +107,6 @@ int main(void) // Call driver init functions before starting NoRTOS/RTOS Board_init(); - // TI Drivers init before starting NoRTOS/RTOS - UART_init(); - NVS_init(); - //I2C_init(); - //SPI_init(); - //TRNG_init(); - // Start NoRTOS (this just enables the HwI globally and returns immediately as // we are not using RTOS here) NoRTOS_start(); diff --git a/src/cc1310_platform.cpp b/src/cc1310_platform.cpp index 023c4fe..d7328b8 100644 --- a/src/cc1310_platform.cpp +++ b/src/cc1310_platform.cpp @@ -76,8 +76,14 @@ CC1310Platform::~CC1310Platform() { } -void CC1310Platform::earlyInit() +void CC1310Platform::init() { + // TI Drivers init + // According to SDK docs it is safe to call them AFTER NoRTOS_Start() + // If RTOS is used and multiple thread use the same driver, then the init shall be performed before BIOS_Start() + UART_init(); + NVS_init(); + // Init UART InitUART(); diff --git a/src/cc1310_platform.h b/src/cc1310_platform.h index deff941..d31f3a7 100644 --- a/src/cc1310_platform.h +++ b/src/cc1310_platform.h @@ -14,7 +14,7 @@ class CC1310Platform : public Platform CC1310Platform(); virtual ~CC1310Platform(); - void earlyInit(); + void init(); // basic stuff virtual void restart() final;