From 2f142ed6cd855af0d7908eb153303aec21a32933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Mon, 10 Jun 2019 09:11:08 +0100 Subject: [PATCH] Work in TI CC3220SF target - Move to TI-RTOS instead of FreeRTOS. - Bring CC32xx SDK to v4.10.00.07. - Bring code base up to date with develop branch. - Update block storage config. - Enable build of this target in Azure Pipeline yaml. Signed-off-by: josesimoes --- CMake/Modules/FindTI_SimpleLink.cmake | 226 ++++--- .../TI_SimpleLink_CC13x2_26x2_sources.cmake | 1 + .../TI_SimpleLink_CC32xx_GCC_options.cmake | 2 +- .../TI_SimpleLink_CC32xx_sources.cmake | 236 +------ azure-pipelines.yml | 8 +- .../Networking.Sntp/nf_networking_sntp.h | 2 +- targets/TI-SimpleLink/CMakeLists.txt | 126 ++-- .../Include/CLR_Startup_Thread.h | 2 +- .../Include/WireProtocol_ReceiverThread.h | 2 +- targets/TI-SimpleLink/Include/targetHAL.h | 4 +- .../TI-SimpleLink/Include/targetHAL_Time.h | 2 - .../Include/targetSimpleLinkCC32xx_Threads.h | 4 +- .../TI_CC1352R1_LAUNCHXL/CMakeLists.txt | 2 + .../TI_CC3220SF_LAUNCHXL/Board.h | 7 +- .../TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.c | 12 +- .../TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.h | 12 +- .../TI_CC3220SF_LAUNCHXL/CMakeLists.txt | 65 +- .../TI_CC3220SF_LAUNCHXL/FreeRTOSConfig.h | 207 ------- .../common/Device_BlockStorage-DEBUG.c | 4 +- .../common/Device_BlockStorage.c | 4 +- .../nanoCLR/CC3220SF_CLR-DEBUG.ld | 50 +- .../nanoCLR/CC3220SF_CLR.ld | 50 +- .../TI_CC3220SF_LAUNCHXL/nanoCLR/main.c | 76 ++- .../target_BlockStorage.h | 4 +- .../TI_CC3220SF_LAUNCHXL/ti-rtos-debug.cfg | 574 ++++++++++++++++++ .../TI_CC3220SF_LAUNCHXL/ti-rtos-release.cfg | 574 ++++++++++++++++++ targets/TI-SimpleLink/common/CMakeLists.txt | 2 - .../TI-SimpleLink/common/FreeRTOS-openocd.c | 20 - .../common/WireProtocol_ReceiverThread.c | 2 - .../TI-SimpleLink/common/platformHAL_Time.cpp | 3 +- .../TI-SimpleLink/nanoCLR/targetHAL_Time.cpp | 4 +- .../nanoCLR/targetPAL_Events.cpp | 15 - .../TI-SimpleLink/nanoCLR/targetPAL_Time.cpp | 13 +- .../nanoCLR/targetSimpleLinkCC32xx_Sntp.c | 5 +- .../nanoCLR/targetSimpleLinkCC32xx_Threads.c | 29 +- 35 files changed, 1587 insertions(+), 762 deletions(-) delete mode 100644 targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/FreeRTOSConfig.h create mode 100644 targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-debug.cfg create mode 100644 targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-release.cfg delete mode 100644 targets/TI-SimpleLink/common/FreeRTOS-openocd.c diff --git a/CMake/Modules/FindTI_SimpleLink.cmake b/CMake/Modules/FindTI_SimpleLink.cmake index 9b1b6a8056..84d1c1bffb 100644 --- a/CMake/Modules/FindTI_SimpleLink.cmake +++ b/CMake/Modules/FindTI_SimpleLink.cmake @@ -27,85 +27,147 @@ include(TI_SimpleLink_${TARGET_SERIES}_sources) # and here the GCC options tuned for the target series include(TI_SimpleLink_${TARGET_SERIES}_GCC_options) -list(APPEND TI_SimpleLink_INCLUDE_DIRS "${TARGET_BASE_LOCATION}") - -if(TARGET_SERIES STREQUAL "CC32xx") - - # includes for FreeRTOS - list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/FreeRTOS_Source/lib/include") - list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/FreeRTOS_Source/lib/include/private") - list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/FreeRTOS_Source/lib/FreeRTOS/portable/GCC/ARM_CM3") - - # source files for FreeRTOS - set(FreeRTOS_SRCS - - # FreeRTOS - event_groups.c - list.c - queue.c - stream_buffer.c - tasks.c - timers.c - port.c - heap_4.c - clock.c - memory.c - mqueue.c - pthread_barrier.c - pthread_cond.c - pthread.c - pthread_mutex.c - pthread_rwlock.c - sched.c - semaphore.c - sleep.c - timer.c - PTLS.c - aeabi_portable.c - - HwiPCC32XX_freertos.c - PowerCC32XX_freertos.c - startup_cc32xx_gcc.c - ClockP_freertos.c - DebugP_freertos.c - MutexP_freertos.c - SemaphoreP_freertos.c - SystemP_freertos.c - - ) - - foreach(SRC_FILE ${FreeRTOS_SRCS}) - set(FreeRTOS_SCR_FILE SRC_FILE -NOTFOUND) - find_file(FreeRTOS_SCR_FILE ${SRC_FILE} - PATHS - - # FreeRTOS - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/posix/freertos" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/kernel/tirtos/dpl" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/kernel/freertos/startup" - "${PROJECT_BINARY_DIR}/FreeRTOS_Source/lib/FreeRTOS/portable/MemMang" - "${PROJECT_BINARY_DIR}/FreeRTOS_Source/lib/FreeRTOS/portable/GCC/ARM_CM3" - "${PROJECT_BINARY_DIR}/FreeRTOS_Source/lib/FreeRTOS" - - CMAKE_FIND_ROOT_PATH_BOTH - ) - # message("${SRC_FILE} >> ${FreeRTOS_SCR_FILE}") # debug helper - list(APPEND TI_SimpleLink_SOURCES ${FreeRTOS_SCR_FILE}) - endforeach() - -elseif(TARGET_SERIES STREQUAL "CC13x2_26x2") - - # includes for TI-RTOS - list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC13x2_26x2SDK_Source/kernel/tirtos/packages") - - # includes for XDC Tools - list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/TI_XDCTools_Source/packages") - - # need a dummy include for the sources - list(APPEND TI_SimpleLink_SOURCES " ") - -endif() - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(TI_SimpleLink DEFAULT_MSG TI_SimpleLink_INCLUDE_DIRS TI_SimpleLink_SOURCES) +# # includes for TI_RTOS +# list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/posix/gcc") +# list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/posix/tirtos") +list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages") +list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/ti/sysbios") +# list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/ti/sysbios/knl") +# list(APPEND TI_SimpleLink_INCLUDE_DIRS "${TARGET_BASE_LOCATION}") + +# # source files for TI_RTOS +# set(TI_RTOS_SRCS + +# # TI_RTOS +# ClockP_tirtos.c +# DebugP_tirtos.c +# HwiP_tirtos.c +# MutexP_tirtos.c +# SemaphoreP_tirtos.c +# SwiP_tirtos.c +# SystemP_tirtos.c +# PowerCC32XX_tirtos.c + +# # sys/bios +# BIOS.c +# Clock.c +# Event.c +# Idle.c +# Intrinsics.c +# Mailbox.c +# Queue.c +# Semaphore_svc.c +# Semaphore.c +# Swi_smp.c +# Swi.c +# Task_smp.c +# Task_svc.c +# Task.c + + + + + +# # posix +# clock.c +# mqueue.c +# pthread_barrier.c +# pthread_cond.c +# pthread.c +# pthread_mutex.c +# pthread_rwlock.c +# sched.c +# semaphore.c +# sleep.c +# timer.c + + +# # HwiPCC32XX_freertos.c +# # PowerCC32XX_freertos.c +# # startup_cc32xx_gcc.c + +# ) + +# foreach(SRC_FILE ${TI_RTOS_SRCS}) +# set(TI_RTOS_SCR_FILE SRC_FILE -NOTFOUND) +# find_file(TI_RTOS_SCR_FILE ${SRC_FILE} +# PATHS + +# # TI_RTOS +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/posix/tirtos" +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/kernel/tirtos/packages/ti/dpl" +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/ti/sysbios" +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/ti/sysbios/knl" + +# CMAKE_FIND_ROOT_PATH_BOTH +# ) +# # message("${SRC_FILE} >> ${TI_RTOS_SCR_FILE}") # debug helper +# list(APPEND TI_SimpleLink_SOURCES ${TI_RTOS_SCR_FILE}) +# endforeach() + +# # includes for FreeRTOS +# list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/FreeRTOS_Source/include") +# list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/FreeRTOS_Source/portable/GCC/ARM_CM3") +# list(APPEND TI_SimpleLink_INCLUDE_DIRS "${TARGET_BASE_LOCATION}") + +# # source files for FreeRTOS +# set(FreeRTOS_SRCS + +# # FreeRTOS +# croutine.c +# event_groups.c +# list.c +# queue.c +# stream_buffer.c +# tasks.c +# timers.c +# port.c +# heap_4.c +# clock.c +# memory.c +# mqueue.c +# pthread_barrier.c +# pthread_cond.c +# pthread.c +# pthread_mutex.c +# pthread_rwlock.c +# sched.c +# semaphore.c +# sleep.c +# timer.c +# PTLS.c +# aeabi_portable.c +# ClockP_freertos.c +# DebugP_freertos.c +# MutexP_freertos.c +# SemaphoreP_freertos.c +# SystemP_freertos.c +# HwiPCC32XX_freertos.c +# PowerCC32XX_freertos.c +# startup_cc32xx_gcc.c + +# ) + +# foreach(SRC_FILE ${FreeRTOS_SRCS}) +# set(FreeRTOS_SCR_FILE SRC_FILE -NOTFOUND) +# find_file(FreeRTOS_SCR_FILE ${SRC_FILE} +# PATHS + +# # FreeRTOS +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/posix/freertos" +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/source" +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/kernel/freertos/dpl" +# "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/kernel/freertos/startup" +# "${PROJECT_BINARY_DIR}/FreeRTOS_Source/portable/MemMang" +# "${PROJECT_BINARY_DIR}/FreeRTOS_Source/portable/GCC/ARM_CM3" +# "${PROJECT_BINARY_DIR}/FreeRTOS_Source" + +# CMAKE_FIND_ROOT_PATH_BOTH +# ) +# # message("${SRC_FILE} >> ${FreeRTOS_SCR_FILE}") # debug helper +# list(APPEND TI_SimpleLink_SOURCES ${FreeRTOS_SCR_FILE}) +# endforeach() + +# include(FindPackageHandleStandardArgs) + +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(TI_SimpleLink DEFAULT_MSG TI_SimpleLink_INCLUDE_DIRS TI_SimpleLink_SOURCES) diff --git a/CMake/Modules/TI_SimpleLink_CC13x2_26x2_sources.cmake b/CMake/Modules/TI_SimpleLink_CC13x2_26x2_sources.cmake index bb51a901e5..12c5c2321a 100644 --- a/CMake/Modules/TI_SimpleLink_CC13x2_26x2_sources.cmake +++ b/CMake/Modules/TI_SimpleLink_CC13x2_26x2_sources.cmake @@ -16,5 +16,6 @@ list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC13x2_2 list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC13x2_26x2SDK_Source/ti/devices/cc13x2_cc26x2/driverlib") list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC13x2_26x2SDK_Source/ti/net") list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC13x2_26x2SDK_Source/ti/bsd") +list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC13x2_26x2SDK_Source/kernel/tirtos/packages") # the sources files are pulled into the build in the target CMakelists through the XDS tools command line diff --git a/CMake/Modules/TI_SimpleLink_CC32xx_GCC_options.cmake b/CMake/Modules/TI_SimpleLink_CC32xx_GCC_options.cmake index 72b2250ac3..53102c6aec 100644 --- a/CMake/Modules/TI_SimpleLink_CC32xx_GCC_options.cmake +++ b/CMake/Modules/TI_SimpleLink_CC32xx_GCC_options.cmake @@ -12,7 +12,7 @@ set(CMAKE_ASM_FLAGS " -mthumb -mcpu=cortex-m4 -x assembler-with-cpp" CACHE INTER # need to specify linker flags here # -mfpu=fpv5-sp-d16 -set(CMAKE_EXE_LINKER_FLAGS " -Wl,--gc-sections -Wl,--no-wchar-size-warning -Wl,--print-memory-usage -mcpu=cortex-m4 -march=armv7e-m -mthumb -nostartfiles -std=c99 -mfloat-abi=soft -ffunction-sections -fdata-sections -g -gstrict-dwarf -Wall " CACHE INTERNAL "executable linker flags") +set(CMAKE_EXE_LINKER_FLAGS " -Wl,--gc-sections -Wl,--no-wchar-size-warning -Wl,--print-memory-usage -mcpu=cortex-m4 -march=armv7e-m -mthumb -nostartfiles -std=c99 -mfloat-abi=soft -ffunction-sections -fdata-sections -g -gstrict-dwarf -Wall -I${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/include/newlib-nano -I${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/include" CACHE INTERNAL "executable linker flags") function(NF_SET_COMPILER_OPTIONS TARGET) diff --git a/CMake/Modules/TI_SimpleLink_CC32xx_sources.cmake b/CMake/Modules/TI_SimpleLink_CC32xx_sources.cmake index 12c3df28ed..5a814fc525 100644 --- a/CMake/Modules/TI_SimpleLink_CC32xx_sources.cmake +++ b/CMake/Modules/TI_SimpleLink_CC32xx_sources.cmake @@ -3,11 +3,16 @@ # See LICENSE file in the project root for full license information. # +# grab the board name from the target name +# need to strip out the leading 'TI_' like in 'TI_CC3220SF_LAUNCHXL' + +string(REPLACE "TI_" "" TARGET_NAME_SHORT "${TARGET_NAME}") + # includes for SimpleLink CC32xx SDK list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source") list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers") list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/posix/gcc") -list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/boards/CC3220SF_LAUNCHXL") +list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/boards/${TARGET_NAME_SHORT}") list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/devices/cc32xx") list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/devices/cc32xx/driverlib") list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/net") @@ -16,230 +21,7 @@ list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSD # includes for nanoFramework SSL driver list(APPEND TI_SimpleLink_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/PAL/Com/sockets/ssl") +# source file for nanoFramework SSL driver +list(APPEND TI_SimpleLink_SOURCES ${PROJECT_SOURCE_DIR}/src/PAL/COM/sockets/ssl/ssl.cpp) -# source files for board drivers -set(BoardDrivers_SRCS - - # board drivers - # NVS.c - # NVSRAM.c - # NVSSPI25X.c - # SD.c - # SDSPI.c - # SDFatFS.c - List.c - RingBuf.c - ADC.c - ADCCC32XX.c - # Camera.c - # CameraCC32XXDMA.c - Capture.c - CaptureCC32XX.c - CryptoCC32XX.c - UDMACC32XX.c - GPIOCC32XX.c - I2C.c - I2CCC32XX.c - I2S.c - PowerCC32XX.c - PowerCC32XX_asm.sm4g - PWM.c - PWMTimerCC32XX.c - SDHostCC32XX.c - SPI.c - SPICC32XXDMA.c - SPICC32XXDMA.c - Timer.c - TimerCC32XX.c - UART.c - UARTCC32XX.c - UARTCC32XXDMA.c - Watchdog.c - WatchdogCC32XX.c -) - -foreach(SRC_FILE ${BoardDrivers_SRCS}) - set(BoardDrivers_SCR_FILE SRC_FILE -NOTFOUND) - find_file(BoardDrivers_SCR_FILE ${SRC_FILE} - PATHS - - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/nvs" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/sd" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/adc" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/camera" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/capture" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/crypto" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/dma" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/gpio" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/i2c" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/i2s" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/power" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/pwm" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/sd" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/spi" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/timer" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/uart" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/watchdog" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/utils" - - CMAKE_FIND_ROOT_PATH_BOTH - ) - # message("${SRC_FILE} >> ${BoardDrivers_SCR_FILE}") # debug helper - list(APPEND TI_SimpleLink_SOURCES ${BoardDrivers_SCR_FILE}) -endforeach() - -# need to specify a language for this assembler source file because its not using a standard extension -set_source_files_properties("${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/power/PowerCC32XX_asm.sm4g" PROPERTIES LANGUAGE ASM) - -# source files for drivers library -set(DriversLibrary_SRCS - - #drivers library - adc.c - aes.c - camera.c - cpu.c - crc.c - des.c - flash.c - gpio.c - hwspinlock.c - i2c.c - interrupt.c - i2s.c - pin.c - prcm.c - sdhost.c - shamd5.c - spi.c - systick.c - timer.c - uart.c - udma.c - utils.c - wdt.c - - # display specific - DisplayUart.c -) - -foreach(SRC_FILE ${DriversLibrary_SRCS}) - set(DriversLibrary_SCR_FILE SRC_FILE -NOTFOUND) - find_file(DriversLibrary_SCR_FILE ${SRC_FILE} - PATHS - - #drivers library - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/devices/cc32xx/driverlib" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/display" - - CMAKE_FIND_ROOT_PATH_BOTH - ) - # message("${SRC_FILE} >> ${DriversLibrary_SCR_FILE}") # debug helper - list(APPEND TI_SimpleLink_SOURCES ${DriversLibrary_SCR_FILE}) -endforeach() - -# source files for SimpleLink -set(SimpleLink_SRCS - - device.c - driver.c - flowcont.c - fs.c - netapp.c - netcfg.c - netutil.c - nonos.c - sl_socket.c - spawn.c - wlan.c - cc_pal.c - eventreg.c - wlanconfig.c - - # eventreg.c - -) - -foreach(SRC_FILE ${SimpleLink_SRCS}) - set(SimpleLink_SCR_FILE SRC_FILE -NOTFOUND) - find_file(SimpleLink_SCR_FILE ${SRC_FILE} - PATHS - - #drivers library - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/net/wifi" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/net/wifi/porting" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/net/wifi/source" - - CMAKE_FIND_ROOT_PATH_BOTH - ) - # message("${SRC_FILE} >> ${SimpleLink_SCR_FILE}") # debug helper - list(APPEND TI_SimpleLink_SOURCES ${SimpleLink_SCR_FILE}) -endforeach() - - -# source files for SimpleLink net Wi-Fi -set(SLNetWiFi_SRCS - - slnetsock.c - slnetutils.c - slnetif.c - - # bsd - netdb.c - socket.c - errnoutil.c - - # drivers - eventreg.c - slnetifwifi.c - - # utils - clock_sync.c -) - -foreach(SRC_FILE ${SLNetWiFi_SRCS}) - set(SLNetWiFi_SCR_FILE SRC_FILE -NOTFOUND) - find_file(SLNetWiFi_SCR_FILE ${SRC_FILE} - PATHS - - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/net" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/net/bsd" - - # drivers - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/net/wifi" - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers/net/wifi/slnetif" - - # utils - "${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/net/utils" - - CMAKE_FIND_ROOT_PATH_BOTH - ) - # message("${SRC_FILE} >> ${SLNetWiFi_SCR_FILE}") # debug helper - list(APPEND TI_SimpleLink_SOURCES ${SLNetWiFi_SCR_FILE}) -endforeach() - - -# source files for nanoFramework SSL driver -set(nanoSsl_SRCS - - ssl.cpp -) - -foreach(SRC_FILE ${nanoSsl_SRCS}) - set(nanoSsl_SCR_FILE SRC_FILE -NOTFOUND) - find_file(nanoSsl_SCR_FILE ${SRC_FILE} - PATHS - - "${PROJECT_SOURCE_DIR}/src/PAL/COM/sockets/ssl" - - CMAKE_FIND_ROOT_PATH_BOTH - ) - # message("${SRC_FILE} >> ${nanoSsl_SCR_FILE}") # debug helper - list(APPEND TI_SimpleLink_SOURCES ${nanoSsl_SCR_FILE}) -endforeach() - - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SimpleLinkCC32xxSDK DEFAULT_MSG TI_SimpleLink_INCLUDE_DIRS TI_SimpleLink_SOURCES) +# the sources files are pulled into the build in the target CMakelists through the XDS tools command line diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0648790a8b..87233b26f0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -299,10 +299,10 @@ jobs: strategy: matrix: - # TI_CC3220SF_LAUNCHXL: - # BoardName: TI_CC3220SF_LAUNCHXL - # BuildOptions: -DTARGET_SERIES=CC32xx -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON - # GccArm_Version: + TI_CC3220SF_LAUNCHXL: + BoardName: TI_CC3220SF_LAUNCHXL + BuildOptions: -DTARGET_SERIES=CC32xx -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON + GccArm_Version: TI_CC1352R1_LAUNCHXL: BoardName: TI_CC1352R1_LAUNCHXL BuildOptions: -DTARGET_SERIES=CC13x2_26x2 -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=OFF -DAPI_Windows.Devices.I2c=OFF -DAPI_Windows.Devices.Pwm=OFF -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=OFF -DAPI_nanoFramework.TI.EasyLink=ON diff --git a/src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h b/src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h index d631381819..833eaabbb2 100644 --- a/src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h +++ b/src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h @@ -15,7 +15,7 @@ extern "C" { -#ifdef CC32XX +#ifdef DeviceFamily_CC3220 #include #else #include diff --git a/targets/TI-SimpleLink/CMakeLists.txt b/targets/TI-SimpleLink/CMakeLists.txt index 6878c522f5..9822d70124 100644 --- a/targets/TI-SimpleLink/CMakeLists.txt +++ b/targets/TI-SimpleLink/CMakeLists.txt @@ -15,7 +15,7 @@ add_subdirectory(nanoCLR) ######################################## if("${TARGET_SERIES}" STREQUAL "CC32xx") - # CC32xx series is using TI SimpleLink CC32xx SDK and FreeRTOS + # CC32xx series is using TI SimpleLink CC32xx SDK and TI RTOS # check if TI_SL_CC32xx_SDK_SOURCE was specified or if it's empty (default is empty) set(NO_TI_SL_CC32xx_SDK_SOURCE TRUE) @@ -37,7 +37,7 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") endif() message(STATUS "TI SimpleLink CC32xx SDK (latest available code from v3.10.00.04") - set(TI_SL_CC32xx_SDK_TAG "3.10.00.04") + set(TI_SL_CC32xx_SDK_TAG "4.10.00.07") # need to setup a separate CMake project to download the code from the GitHub repository # otherwise it won't be available before the actual build step @@ -109,18 +109,18 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") # get source dir for TI SimpleLink CC32xx SDK CMake project ExternalProject_Get_Property(SimpleLinkCC32xxSDK SOURCE_DIR) + endif() - # check if FREERTOS_SOURCE was specified or if it's empty (default is empty) - set(NO_FREERTOS_SOURCE TRUE) - if(FREERTOS_SOURCE) - if(NOT "${FREERTOS_SOURCE}" STREQUAL "") - set(NO_FREERTOS_SOURCE FALSE) + # check if TI_XDCTOOLS_SOURCE was specified or if it's empty (default is empty) + set(NO_TI_XDCTOOLS_SOURCE TRUE) + if(TI_XDCTOOLS_SOURCE) + if(NOT "${TI_XDCTOOLS_SOURCE}" STREQUAL "") + set(NO_TI_XDCTOOLS_SOURCE FALSE) endif() endif() - - if(NO_FREERTOS_SOURCE) - # no FreeRTOS source specified, download it from it's repo + if(NO_TI_XDCTOOLS_SOURCE) + # no TI XDCTools source specified, download it from it's repo # check for Git (needed here for advanced warning to user if it's not installed) find_package(Git) @@ -130,100 +130,107 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") message(FATAL_ERROR "error: could not find Git, make sure you have it installed.") endif() - # FreeRTOS version - set(FREERTOS_VERSION_EMPTY TRUE) + # TI XDCTools version + set(TI_XDCTOOLS_VERSION_EMPTY TRUE) - # check if build was requested with a specifc FreeRTOS version - if(DEFINED FREERTOS_VERSION) - if(NOT "${FREERTOS_VERSION}" STREQUAL "") - set(FREERTOS_VERSION_EMPTY FALSE) + # check if build was requested with a specifc TI XDCTools version + if(DEFINED TI_XDCTOOLS_VERSION) + if(NOT "${TI_XDCTOOLS_VERSION}" STREQUAL "") + set(TI_XDCTOOLS_VERSION_EMPTY FALSE) endif() endif() - # FreeRTOS version - set(FREERTOS_VERSION_EMPTY TRUE) + # TI XDCTools version + set(TI_XDCTOOLS_VERSION_EMPTY TRUE) - # check if build was requested with a specifc FreeRTOS version - if(FREERTOS_VERSION_EMPTY) - # no FreeRTOS version actualy specified, must be empty which is fine, we'll default to a known good version - set(FREERTOS_VERSION_TAG "V10.2.1") + # check if build was requested with a specifc TI XDCTools version + if(TI_XDCTOOLS_VERSION_EMPTY) + # no TI XDCTools version actualy specified, must be empty which is fine, we'll default to a known good version + set(TI_XDCTOOLS_VERSION_TAG "3.61.00.16") else() # set SVN tag - set(FREERTOS_VERSION_TAG "${FREERTOS_VERSION}") + set(TI_XDCTOOLS_VERSION_TAG "${TI_XDCTOOLS_VERSION}") endif() - message(STATUS "RTOS is: FreeRTOS ${FREERTOS_VERSION} from GitHub repo") + message(STATUS "TI XDCTools ${TI_XDCTOOLS_VERSION} from GitHub repo") # need to setup a separate CMake project to download the code from the GitHub repository # otherwise it won't be available before the actual build step - configure_file("${PROJECT_SOURCE_DIR}/CMake/FreeRTOS.CMakeLists.cmake.in" - "${CMAKE_BINARY_DIR}/FreeRTOS_Download/CMakeLists.txt") + configure_file("${PROJECT_SOURCE_DIR}/CMake/TI_XDCTools.CMakeLists.cmake.in" + "${CMAKE_BINARY_DIR}/TI_XDCTools_Download/CMakeLists.txt") - # setup CMake project for FreeRTOS download + # setup CMake project for TI XDCTools download execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/FreeRTOS_Download") + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/TI_XDCTools_Download") - # run build on FreeRTOS download CMake project to perform the download + # run build on TI XDCTools download CMake project to perform the download execute_process(COMMAND ${CMAKE_COMMAND} --build . RESULT_VARIABLE result - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/FreeRTOS_Download") - - # add FreeRTOS as external project - ExternalProject_Add( - FreeRTOS - PREFIX FreeRTOS - SOURCE_DIR ${CMAKE_BINARY_DIR}/FreeRTOS_Source - GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Kernel.git - GIT_TAG ${FREERTOS_VERSION_TAG} # target specified branch + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/TI_XDCTools_Download") + + # add TI XDCTools as external project + ExternalProject_Add( + TI_XDCTools + PREFIX TI_XDCTools + SOURCE_DIR ${CMAKE_BINARY_DIR}/TI_XDCTools_Source + GIT_REPOSITORY https://github.com/nanoframework/TI_XDCTools + GIT_TAG ${TI_XDCTools_TAG} # target specified branch GIT_SHALLOW 1 # download only the tip of the branch, not the complete history TIMEOUT 10 LOG_DOWNLOAD 1 + # Disable all other steps INSTALL_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" - ) + ) + + # get source dir for TI XDCTools CMake project + ExternalProject_Get_Property(TI_XDCTools SOURCE_DIR) + set(TI_XDCTools_INCLUDE_DIR "${CMAKE_BINARY_DIR}/TI_XDCTools_Source/packages" PARENT_SCOPE) else() - # FreeRTOS source was specified + # TI XDCTools source was specified # sanity check is source path exists - if(EXISTS "${FREERTOS_SOURCE}/") - message(STATUS "RTOS is: FreeRTOS (source from: ${FREERTOS_SOURCE})") + if(EXISTS "${TI_XDCTOOLS_SOURCE}/") + message(STATUS "TI XDCTools (source from: ${TI_XDCTOOLS_SOURCE})") # check if we already have the sources, no need to copy again - NF_DIRECTORY_EXISTS_NOT_EMPTY(${CMAKE_BINARY_DIR}/FreeRTOS_Source SOURCE_EXISTS) + NF_DIRECTORY_EXISTS_NOT_EMPTY(${CMAKE_BINARY_DIR}/TI_XDCTools_Source SOURCE_EXISTS) if(NOT ${SOURCE_EXISTS}) - file(COPY "${FREERTOS_SOURCE}/" DESTINATION "${CMAKE_BINARY_DIR}/FreeRTOS_Source") + file(COPY "${TI_XDCTOOLS_SOURCE}/" DESTINATION "${CMAKE_BINARY_DIR}/TI_XDCTools_Source") else() - message(STATUS "Using local cache of FreeRTOS source from ${FREERTOS_SOURCE}") + message(STATUS "Using local cache of TI XDCTools source from ${TI_XDCTOOLS_SOURCE}") endif() - set(FREERTOS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/FreeRTOS_Source/include) else() - message(FATAL_ERROR "Couldn't find FreeRTOS source at ${FREERTOS_SOURCE}/") + message(FATAL_ERROR "Couldn't find TI XDCTools source at ${TI_XDCTOOLS_SOURCE}/") endif() - # add FreeRTOS as external project + # add TI XDCTools as external project ExternalProject_Add( - FreeRTOS - PREFIX FreeRTOS - SOURCE_DIR ${CMAKE_BINARY_DIR}/FreeRTOS_Source + TI_XDCTools + PREFIX TI_XDCTools + SOURCE_DIR ${CMAKE_BINARY_DIR}/TI_XDCTools_Source # Disable all other steps INSTALL_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" ) - # get source dir for FreeRTOS CMake project - ExternalProject_Get_Property(FreeRTOS SOURCE_DIR) + # get source dir for TI XDCTools CMake project + ExternalProject_Get_Property(TI_XDCTools SOURCE_DIR) + set(TI_XDCTools_INCLUDE_DIR ${CMAKE_BINARY_DIR}/TI_XDCTools_Source/packages PARENT_SCOPE) endif() - add_subdirectory(${TI_BOARD}) - + # need to override the toolchain lib directory + set(TOOLCHAIN_INC_DIR ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) + set(TOOLCHAIN_LIB_DIR ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) + ############################################ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) @@ -358,7 +365,7 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) # check if build was requested with a specifc TI XDCTools version if(TI_XDCTOOLS_VERSION_EMPTY) # no TI XDCTools version actualy specified, must be empty which is fine, we'll default to a known good version - set(TI_XDCTOOLS_VERSION_TAG "3.51.03.28") + set(TI_XDCTOOLS_VERSION_TAG "3.61.00.16") else() # set SVN tag set(TI_XDCTOOLS_VERSION_TAG "${TI_XDCTOOLS_VERSION}") @@ -398,6 +405,10 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) BUILD_COMMAND "" ) + # get source dir for TI XDCTools CMake project + ExternalProject_Get_Property(TI_XDCTools SOURCE_DIR) + set(TI_XDCTools_INCLUDE_DIR ${CMAKE_BINARY_DIR}/TI_XDCTools_Source/packages PARENT_SCOPE) + else() # TI XDCTools source was specified @@ -414,7 +425,6 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) message(STATUS "Using local cache of TI XDCTools source from ${TI_XDCTOOLS_SOURCE}") endif() - set(TI_XDCTOOLS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/TI_XDCTools_Source/packages) else() message(FATAL_ERROR "Couldn't find TI XDCTools source at ${TI_XDCTOOLS_SOURCE}/") endif() @@ -432,6 +442,7 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) # get source dir for TI XDCTools CMake project ExternalProject_Get_Property(TI_XDCTools SOURCE_DIR) + set(TI_XDCTools_INCLUDE_DIR "${CMAKE_BINARY_DIR}/TI_XDCTools_Source/packages" PARENT_SCOPE) endif() @@ -440,4 +451,3 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) set(TOOLCHAIN_LIB_DIR ${PROJECT_BINARY_DIR}/SimpleLinkCC13x2_26x2SDK_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) endif() - diff --git a/targets/TI-SimpleLink/Include/CLR_Startup_Thread.h b/targets/TI-SimpleLink/Include/CLR_Startup_Thread.h index 3c394ef4be..6d7f483e83 100644 --- a/targets/TI-SimpleLink/Include/CLR_Startup_Thread.h +++ b/targets/TI-SimpleLink/Include/CLR_Startup_Thread.h @@ -7,6 +7,6 @@ #define _CLRSTARTUPTHREAD_ // declaration of RTOS thread -void CLRStartupThread(void const * argument); +void CLRStartupThread(UArg arg0, UArg arg1); #endif //_CLRSTARTUPTHREAD_ diff --git a/targets/TI-SimpleLink/Include/WireProtocol_ReceiverThread.h b/targets/TI-SimpleLink/Include/WireProtocol_ReceiverThread.h index 2ab358a686..a9f2a3ab7b 100644 --- a/targets/TI-SimpleLink/Include/WireProtocol_ReceiverThread.h +++ b/targets/TI-SimpleLink/Include/WireProtocol_ReceiverThread.h @@ -7,6 +7,6 @@ #define _WIREPROTOCOL_RECEIVERTHREAD_H_ // declaration of RTOS thread -void* ReceiverThread(void* argument); +void ReceiverThread(UArg arg0, UArg arg1); #endif //_WIREPROTOCOL_RECEIVERTHREAD_H_ diff --git a/targets/TI-SimpleLink/Include/targetHAL.h b/targets/TI-SimpleLink/Include/targetHAL.h index 28082b5f8a..4419598d48 100644 --- a/targets/TI-SimpleLink/Include/targetHAL.h +++ b/targets/TI-SimpleLink/Include/targetHAL.h @@ -12,8 +12,8 @@ #include #include -#define GLOBAL_LOCK() uint32_t taskKey = Task_disable(); -#define GLOBAL_UNLOCK() Task_restore(taskKey); +#define GLOBAL_LOCK() uint32_t taskKey = Task_disable(); +#define GLOBAL_UNLOCK() Task_restore(taskKey); // platform dependent delay #define PLATFORM_DELAY(milliSecs) ClockP_usleep(milliSecs * 1000); diff --git a/targets/TI-SimpleLink/Include/targetHAL_Time.h b/targets/TI-SimpleLink/Include/targetHAL_Time.h index 7788c238ed..ec0f9e3e07 100644 --- a/targets/TI-SimpleLink/Include/targetHAL_Time.h +++ b/targets/TI-SimpleLink/Include/targetHAL_Time.h @@ -6,8 +6,6 @@ #ifndef _TARGET_HAL_TIME_H_ #define _TARGET_HAL_TIME_H_ 1 -// #include -// #include #include #define HAL_Time_CurrentSysTicks Clock_getTicks diff --git a/targets/TI-SimpleLink/Include/targetSimpleLinkCC32xx_Threads.h b/targets/TI-SimpleLink/Include/targetSimpleLinkCC32xx_Threads.h index 28f1f6222a..1e81da2c17 100644 --- a/targets/TI-SimpleLink/Include/targetSimpleLinkCC32xx_Threads.h +++ b/targets/TI-SimpleLink/Include/targetSimpleLinkCC32xx_Threads.h @@ -9,15 +9,13 @@ #include -/* POSIX Header files */ +// POSIX Header files #include #include #include #include #include -// #include -// #include #define SL_STOP_TIMEOUT (200) diff --git a/targets/TI-SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt b/targets/TI-SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt index 2ddb7d4d35..afdf7b33d7 100644 --- a/targets/TI-SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt +++ b/targets/TI-SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt @@ -129,6 +129,8 @@ include_directories( "${WireProtocol_INCLUDE_DIRS}" "${TI_SimpleLink_INCLUDE_DIRS}" + ${TI_XDCTools_INCLUDE_DIR} + "${TARGET_TI_SimpleLink_COMMON_INCLUDE_DIRS}" ) diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/Board.h b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/Board.h index 0866af850a..62d2198344 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/Board.h +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/Board.h @@ -9,6 +9,9 @@ #define Board_CC3220SF_LAUNCHXL +#include +#include "CC3220SF_LAUNCHXL.h" + #ifdef __cplusplus extern "C" { #endif @@ -34,8 +37,8 @@ extern "C" { * and PWM peripherals. In order for those examples to work, these LEDs are * taken out of gpioPinCOnfig[] */ -#define Board_GPIO_LED1 CC3220SF_LAUNCHXL_GPIO_LED_D10 -#define Board_GPIO_LED2 CC3220SF_LAUNCHXL_GPIO_LED_D10 +#define Board_GPIO_LED1 CC3220SF_LAUNCHXL_GPIO_LED_D9 +#define Board_GPIO_LED2 CC3220SF_LAUNCHXL_GPIO_LED_D8 #define Board_GPIO_BUTTON0 CC3220SF_LAUNCHXL_GPIO_SW2 #define Board_GPIO_BUTTON1 CC3220SF_LAUNCHXL_GPIO_SW3 diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.c b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.c index 8c9e9c2941..104e686272 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.c +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.c @@ -355,9 +355,9 @@ const uint_least8_t I2C_count = CC3220SF_LAUNCHXL_I2CCOUNT; #include #include -I2SCC32XX_Object i2sCC3220SObjects[CC3220S_LAUNCHXL_I2SCOUNT]; +I2SCC32XX_Object i2sCC3220SFObjects[CC3220SF_LAUNCHXL_I2SCOUNT]; -const I2SCC32XX_HWAttrs i2sCC3220SHWAttrs[CC3220S_LAUNCHXL_I2SCOUNT] = { +const I2SCC32XX_HWAttrs i2sCC3220SFHWAttrs[CC3220SF_LAUNCHXL_I2SCOUNT] = { { .pinSD1 = I2SCC32XX_PIN_50_SD1, .pinSD0 = I2SCC32XX_PIN_64_SD0, @@ -370,14 +370,14 @@ const I2SCC32XX_HWAttrs i2sCC3220SHWAttrs[CC3220S_LAUNCHXL_I2SCOUNT] = { } }; -const I2S_Config I2S_config[CC3220S_LAUNCHXL_I2SCOUNT] = { +const I2S_Config I2S_config[CC3220SF_LAUNCHXL_I2SCOUNT] = { { - .object = &i2sCC3220SObjects[CC3220S_LAUNCHXL_I2S0], - .hwAttrs = &i2sCC3220SHWAttrs[CC3220S_LAUNCHXL_I2S0] + .object = &i2sCC3220SFObjects[CC3220SF_LAUNCHXL_I2S0], + .hwAttrs = &i2sCC3220SFHWAttrs[CC3220SF_LAUNCHXL_I2S0] } }; -const uint_least8_t I2S_count = CC3220S_LAUNCHXL_I2SCOUNT; +const uint_least8_t I2S_count = CC3220SF_LAUNCHXL_I2SCOUNT; /* * =============================== Power =============================== diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.h b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.h index c107c3e622..438f06c406 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.h +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CC3220SF_LAUNCHXL.h @@ -88,14 +88,14 @@ typedef enum CC3220SF_LAUNCHXL_I2CName { } CC3220SF_LAUNCHXL_I2CName; /*! - * @def CC3220S_LAUNCHXL_I2SName - * @brief Enum of I2S names on the CC3220S_LAUNCHXL dev board + * @def CC3220SF_LAUNCHXL_I2SName + * @brief Enum of I2S names on the CC3220SF_LAUNCHXL dev board */ -typedef enum CC3220S_LAUNCHXL_I2SName { - CC3220S_LAUNCHXL_I2S0 = 0, +typedef enum CC3220SF_LAUNCHXL_I2SName { + CC3220SF_LAUNCHXL_I2S0 = 0, - CC3220S_LAUNCHXL_I2SCOUNT -} CC3220S_LAUNCHXL_I2SName; + CC3220SF_LAUNCHXL_I2SCOUNT +} CC3220SF_LAUNCHXL_I2SName; /*! * @def CC3220SF_LAUNCHXL_PWMName diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CMakeLists.txt b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CMakeLists.txt index 7befc655f0..45cf978532 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CMakeLists.txt +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/CMakeLists.txt @@ -3,7 +3,6 @@ # See LICENSE file in the project root for full license information. # -cmake_minimum_required(VERSION 3.0) ENABLE_LANGUAGE(ASM) # add header files with common OS definitions and board definitions specific for each image @@ -68,10 +67,60 @@ add_executable( ${TARGET_NANO_APIS_SOURCES} ) -# add dependency from TI SimpleLink CC32xx SDK and FreeRTOS (this is required to make sure that those repos are downloaded before the build starts) -add_dependencies(${NANOCLR_PROJECT_NAME}.elf FreeRTOS) +target_link_libraries( + ${NANOCLR_PROJECT_NAME}.elf + + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/ti/drivers/lib/drivers_cc32xx.am4g + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/ti/drivers/net/wifi/gcc/rtos/simplelink.a + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/ti/dpl/lib/dpl_cc32xx.am4g + + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/ti/drivers/net/wifi/slnetif/gcc/Release/slnetifwifi.a + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/ti/net/utils/gcc/Release/net_utils.a + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/ti/net/lib/gcc/m4/slnetsock_release.a + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/ti/net/sntp/lib/gcc/m4/sntp_release.a + + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/ti/devices/cc32xx/driverlib/gcc/Release/driverlib.a + + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/nofp/libc_nano.a + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/nofp/libm.a + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/nofp/libnosys.a + + # need to add this a second time otherwise we'll get undefined references + ${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages/ti/dpl/lib/dpl_cc32xx.am4g + +) + +# add dependency from TI SimpleLink CC32xx SDK and XDCTools (this is required to make sure that those repos are downloaded before the build starts) +add_dependencies(${NANOCLR_PROJECT_NAME}.elf TI_XDCTools) add_dependencies(${NANOCLR_PROJECT_NAME}.elf SimpleLinkCC32xxSDK) +###################################### + +# need to copy the configuration file to the build directory +# because the obj files resulting from TI-RTOS build are placed in the same directory as the configuration file +if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + set(TI_RTOS_CONFIG_FILE ti-rtos-debug.cfg) +else() + set(TI_RTOS_CONFIG_FILE ti-rtos-release.cfg) +endif() + +add_custom_command( + TARGET ${NANOCLR_PROJECT_NAME}.elf PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/${TI_RTOS_CONFIG_FILE} + ${CMAKE_CURRENT_BINARY_DIR}/${TI_RTOS_CONFIG_FILE} + COMMENT "Copy TI-RTOS configuration file to build directory" +) + +add_custom_command( + TARGET ${NANOCLR_PROJECT_NAME}.elf PRE_BUILD + COMMAND ${CMAKE_BINARY_DIR}/TI_XDCTools_Source/xs.exe --xdcpath="${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source\;${PROJECT_BINARY_DIR}/SimpleLinkCC32xxSdk_Source/kernel/tirtos/packages\;" xdc.tools.configuro -o configPkg -t gnu.targets.arm.M4 -p ti.platforms.simplelink:CC3220SF -r release -c "${TOOLCHAIN_PREFIX}" --compileOptions "-DDeviceFamily_CC3220" "${CMAKE_CURRENT_BINARY_DIR}/${TI_RTOS_CONFIG_FILE}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generate TI-RTOS configuration" +) + +############################# + # include common directories include_directories( ${CMAKE_CURRENT_BINARY_DIR} @@ -85,6 +134,8 @@ include_directories( "${WireProtocol_INCLUDE_DIRS}" "${TI_SimpleLink_INCLUDE_DIRS}" + ${TI_XDCTools_INCLUDE_DIR} + "${TARGET_TI_SimpleLink_COMMON_INCLUDE_DIRS}" ) @@ -96,7 +147,7 @@ target_include_directories(${NANOCLR_PROJECT_NAME}.elf PUBLIC "${TARGET_TI_SimpleLink_NANOCLR_INCLUDE_DIRS}" # directories for nanoFramework libraries - ${NF_CoreCLR_INCLUDE_DIRS} + ${NF_CoreCLR_INCLUDE_DIRS} ${NF_Debugger_INCLUDE_DIRS} ${NF_Diagnostics_INCLUDE_DIRS} @@ -111,7 +162,7 @@ nf_set_compiler_options(${NANOCLR_PROJECT_NAME}.elf) ############################################### # add -DUSE_CC3220_ROM_DRV_API to use ROM API # ############################################### -nf_set_compiler_definitions(${NANOCLR_PROJECT_NAME}.elf -DCC32XX -DDeviceFamily_CC3220 -DPTLS_TLS_INDEX=0 -DBOARD_DISPLAY_USE_UART_ANSI=0 -DBOARD_DISPLAY_USE_LCD=0 -DconfigNUM_THREAD_LOCAL_STORAGE_POINTERS=1 -DSL_PLATFORM_MULTI_THREADED) +nf_set_compiler_definitions(${NANOCLR_PROJECT_NAME}.elf -DUSE_CC3220_ROM_DRV_API -DDeviceFamily_CC3220 -DBOARD_DISPLAY_USE_UART_ANSI=0 -DBOARD_DISPLAY_USE_LCD=0 ) # set linker files if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) @@ -121,12 +172,14 @@ else() endif() # set linker options -nf_set_linker_options(${NANOCLR_PROJECT_NAME}.elf) +nf_set_linker_options(${NANOCLR_PROJECT_NAME}.elf -Wl,-T,${CMAKE_CURRENT_BINARY_DIR}/configPkg/linker.cmd) # add other linker flags ########################################################### # the size of CRT heap stacks is defined here +# set_property(TARGET ${NANOBOOTER_PROJECT_NAME}.elf APPEND_STRING PROPERTY LINK_FLAGS ",--defsym=__crt_heap_size__=0x0") set_property(TARGET ${NANOCLR_PROJECT_NAME}.elf APPEND_STRING PROPERTY LINK_FLAGS ",--defsym=__crt_heap_size__=0x0") # generate output files +# nf_generate_build_output_files(${NANOBOOTER_PROJECT_NAME}.elf) nf_generate_build_output_files(${NANOCLR_PROJECT_NAME}.elf) diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/FreeRTOSConfig.h b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/FreeRTOSConfig.h deleted file mode 100644 index 6e7fc37917..0000000000 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/FreeRTOSConfig.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * FreeRTOS Kernel V10.0.0 - * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. If you wish to use our Amazon - * FreeRTOS name, please do so in a fair use way that does not cause confusion. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos - * - * 1 tab == 4 spaces! - */ - - -/****************************************************************************** - See http://www.freertos.org/a00110.html for an explanation of the - definitions contained in this file. -******************************************************************************/ - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * http://www.freertos.org/a00110.html - *----------------------------------------------------------*/ - -/* Constants related to the behaviour or the scheduler. */ -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 -#define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) -#define configUSE_PREEMPTION 1 -#define configUSE_TIME_SLICING 0 -#define configMAX_PRIORITIES ( 10UL ) -#define configIDLE_SHOULD_YIELD 0 -#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */ - -/* Constants used to specify if only static allocation is to be supported (in -which case a heap_n.c file is not required), only dynamic allocation is to be -supported, or if both static and dynamic allocation are supported. */ -#define configSUPPORT_STATIC_ALLOCATION 0 -#define configSUPPORT_DYNAMIC_ALLOCATION 1 - -/* Constants that describe the hardware and memory usage. */ -#define configCPU_CLOCK_HZ ( ( unsigned long ) 80000000 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) -#define configMAX_TASK_NAME_LEN ( 12 ) - -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x8000 ) ) - -/* Default stack size for TI-POSIX threads (in words) */ -#define configPOSIX_STACK_SIZE ( ( unsigned short ) 512 ) - -/* Constants that build features in or out. */ -#define configUSE_MUTEXES 1 -#define configUSE_TICKLESS_IDLE 1 -#define configUSE_APPLICATION_TASK_TAG 1 /* Need by POSIX/pthread */ -#define configUSE_CO_ROUTINES 0 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_QUEUE_SETS 0 -#define configUSE_TASK_NOTIFICATIONS 1 - -/* Constants that define which hook (callback) functions should be used. */ -#define configUSE_IDLE_HOOK 0 -#define configUSE_TICK_HOOK 0 -#define configUSE_MALLOC_FAILED_HOOK 1 - -/* Constants provided for debugging and optimisation assistance. */ -#define configCHECK_FOR_STACK_OVERFLOW 2 -#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } -#define configQUEUE_REGISTRY_SIZE 0 - -/* - * Minimum number of full tick periods of idle time required to run Power - * sleep policy function. - */ -#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 5 - -/* Software timer definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY (5) -#define configTIMER_QUEUE_LENGTH (20) -#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) - -#define configENABLE_BACKWARD_COMPATIBILITY 0 - -#if defined(__TI_COMPILER_VERSION__) -#include -#define traceTASK_DELETE( pxTCB ) PTLS_taskDeleteHook( pxTCB ) -#elif defined(__IAR_SYSTEMS_ICC__) -#ifndef __IAR_SYSTEMS_ASM__ -#include -#define traceTASK_DELETE( pxTCB ) Mtx_taskDeleteHook( pxTCB ) -#endif -#endif - -/* - * Enable thread local storage - * - * Assign TLS array index ownership here to avoid collisions. - * TLS storage is needed to implement thread-safe errno with - * TI and IAR compilers. With GNU compiler, we enable newlib. - */ -#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) - -#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 1 - -#if defined(__TI_COMPILER_VERSION__) -#define PTLS_TLS_INDEX 0 /* ti.posix.freertos.PTLS */ -#elif defined(__IAR_SYSTEMS_ICC__) -#define MTX_TLS_INDEX 0 /* ti.posix.freertos.Mtx */ -#endif - -#elif defined(__GNUC__) -/* note: system locks required by newlib are not implemented */ -#define configUSE_NEWLIB_REENTRANT 1 -#endif - -/* - * Set the following definitions to 1 to include the API function, or zero - * to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is only - * necessary if the linker does not automatically remove functions that are not - * referenced anyway. - */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 0 -#define INCLUDE_xTaskGetIdleTaskHandle 0 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xTaskResumeFromISR 0 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_xTaskGetSchedulerState 0 -#define INCLUDE_xSemaphoreGetMutexHolder 0 -#define INCLUDE_xTimerPendFunctionCall 0 - -/* Cortex-M3/4 interrupt priority configuration follows...................... */ - -/* Use the system definition, if there is one. */ -#ifdef __NVIC_PRIO_BITS - #define configPRIO_BITS __NVIC_PRIO_BITS -#else - #define configPRIO_BITS 3 /* 8 priority levels */ -#endif - -/* The lowest interrupt priority that can be used in a call to a "set priority" -function. */ -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07 - -/* - * The highest interrupt priority that can be used by any interrupt service - * routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL - * INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER - * PRIORITY THAN THIS! (higher priorities are lower numeric values. - */ -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1 - -/* - * Priority 7 (shifted 5 since only the top 3 bits are implemented). - * Priority 7 is the lowest priority. - */ -#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) - -/* - * Priority 1 (shifted 5 since only the top 3 bits are implemented). - * Priority 1 is the second highest priority. - * Priority 0 is the highest priority. - * !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! - * See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. - */ -#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) - -/* The trace facility is turned on to make some functions available for use in -CLI commands. */ -#define configUSE_TRACE_FACILITY 1 - -/* Constants related to the generation of run time stats. */ -#define configGENERATE_RUN_TIME_STATS 0 -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() -#define portGET_RUN_TIME_COUNTER_VALUE() 0 - -#endif /* FREERTOS_CONFIG_H */ diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage-DEBUG.c b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage-DEBUG.c index b390452358..1f28f3f30d 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage-DEBUG.c +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage-DEBUG.c @@ -11,8 +11,8 @@ const BlockRange BlockRange1[] = { // the 1st block is reserved for the flash header // so we don't take it into account for the map - { BlockRange_BLOCKTYPE_CODE , 0 , 125 }, // 0x01000800 nanoCLR - { BlockRange_BLOCKTYPE_DEPLOYMENT , 126, 510 }, // 0x0103F000 deployment + { BlockRange_BLOCKTYPE_CODE , 0 , 137 }, // 0x01000800 nanoCLR + { BlockRange_BLOCKTYPE_DEPLOYMENT , 138, 510 }, // 0x01045000 deployment }; const BlockRegionInfo BlockRegions[] = diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage.c b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage.c index acdd399c61..9688dd69b4 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage.c +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage.c @@ -11,8 +11,8 @@ const BlockRange BlockRange1[] = { // the 1st block is reserved for the flash header // so we don't take it into account for the map - { BlockRange_BLOCKTYPE_CODE , 0 , 93 }, // 0x01000800 nanoCLR - { BlockRange_BLOCKTYPE_DEPLOYMENT , 94, 510 }, // 0x0102F800 deployment + { BlockRange_BLOCKTYPE_CODE , 0 , 104 }, // 0x01000800 nanoCLR + { BlockRange_BLOCKTYPE_DEPLOYMENT , 105, 510 }, // 0x01034800 deployment }; const BlockRegionInfo BlockRegions[] = diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR-DEBUG.ld b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR-DEBUG.ld index 5987d6c57f..4e31ff8fdc 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR-DEBUG.ld +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR-DEBUG.ld @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Texas Instruments Incorporated + * Copyright (c) 2016-2018, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,12 +30,17 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -STACKSIZE = 0x800; +/* + * ======== CC3220SF_LAUNCHXL_TIRTOS.lds ======== + */ + +STACKSIZE = 1024; +HEAPSIZE = 0x8000; /* Size of heap buffer used by HeapMem */ MEMORY { FLASH_HDR (RX) : ORIGIN = 0x01000000, LENGTH = 0x7FF - FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x03F000 + FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x045000 SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00040000 } @@ -50,19 +55,22 @@ REGION_ALIAS("REGION_ARM_EXTAB", FLASH); SECTIONS { - .dbghdr : ALIGN (2048) { + .dbghdr : ALIGN(2048) { KEEP (*(.dbghdr)) } > REGION_HDR - PROVIDE (_resetVecs_base_address = - DEFINED(_resetVecs_base_address) ? _resetVecs_base_address : 0x01000800); + PROVIDE (_intvecs_base_address = + DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x01000800); - .resetVecs (_resetVecs_base_address) : AT (_resetVecs_base_address) { - KEEP (*(.resetVecs)) + .intvecs (_intvecs_base_address) : AT (_intvecs_base_address) { + KEEP (*(.intvecs)) } > REGION_TEXT - .ramVecs (NOLOAD) : ALIGN(1024) { - KEEP (*(.ramVecs)) + PROVIDE (_vtable_base_address = + DEFINED(_vtable_base_address) ? _vtable_base_address : 0x20000000); + + .vtable (_vtable_base_address) (NOLOAD) : { + KEEP (*(.vtable)) } > REGION_DATA .text : { @@ -124,25 +132,23 @@ SECTIONS { end = __heap_start__; _end = end; __end = end; - KEEP(*(.heap)) + KEEP (*(.heap)) __heap_end__ = .; __HeapLimit = __heap_end__; } > REGION_HEAP AT> REGION_HEAP + /* Heap buffer used by HeapMem */ + .priheap : { + . = ALIGN (8); + __primary_heap_start__ = .; + . += HEAPSIZE; + __primary_heap_end__ = .; + } > REGION_HEAP AT> REGION_HEAP + .stack (NOLOAD) : ALIGN(0x8) { _stack = .; __stack = .; - KEEP(*(.stack)) + KEEP (*(.stack)) . += STACKSIZE; - _stack_end = .; - __stack_end = .; } > REGION_STACK AT> REGION_STACK } - -/* RAM region to be used for the nanoFramework CLR managed heap.*/ -REGION_ALIAS("CLR_MANAGED_HEAP_RAM", SRAM); - -/* nanoCLR rules inclusion.*/ -INCLUDE rules_clr.ld - -ENTRY(resetISR) diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR.ld b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR.ld index 88f978a643..97f32267e0 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR.ld +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR.ld @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Texas Instruments Incorporated + * Copyright (c) 2016-2018, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,12 +30,17 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -STACKSIZE = 0x800; +/* + * ======== CC3220SF_LAUNCHXL_TIRTOS.lds ======== + */ + +STACKSIZE = 1024; +HEAPSIZE = 0x8000; /* Size of heap buffer used by HeapMem */ MEMORY { FLASH_HDR (RX) : ORIGIN = 0x01000000, LENGTH = 0x7FF - FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x02F000 + FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x034800 SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00040000 } @@ -50,19 +55,22 @@ REGION_ALIAS("REGION_ARM_EXTAB", FLASH); SECTIONS { - .dbghdr : ALIGN (2048) { + .dbghdr : ALIGN(2048) { KEEP (*(.dbghdr)) } > REGION_HDR - PROVIDE (_resetVecs_base_address = - DEFINED(_resetVecs_base_address) ? _resetVecs_base_address : 0x01000800); + PROVIDE (_intvecs_base_address = + DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x01000800); - .resetVecs (_resetVecs_base_address) : AT (_resetVecs_base_address) { - KEEP (*(.resetVecs)) + .intvecs (_intvecs_base_address) : AT (_intvecs_base_address) { + KEEP (*(.intvecs)) } > REGION_TEXT - .ramVecs (NOLOAD) : ALIGN(1024) { - KEEP (*(.ramVecs)) + PROVIDE (_vtable_base_address = + DEFINED(_vtable_base_address) ? _vtable_base_address : 0x20000000); + + .vtable (_vtable_base_address) (NOLOAD) : { + KEEP (*(.vtable)) } > REGION_DATA .text : { @@ -124,25 +132,23 @@ SECTIONS { end = __heap_start__; _end = end; __end = end; - KEEP(*(.heap)) + KEEP (*(.heap)) __heap_end__ = .; __HeapLimit = __heap_end__; } > REGION_HEAP AT> REGION_HEAP + /* Heap buffer used by HeapMem */ + .priheap : { + . = ALIGN (8); + __primary_heap_start__ = .; + . += HEAPSIZE; + __primary_heap_end__ = .; + } > REGION_HEAP AT> REGION_HEAP + .stack (NOLOAD) : ALIGN(0x8) { _stack = .; __stack = .; - KEEP(*(.stack)) + KEEP (*(.stack)) . += STACKSIZE; - _stack_end = .; - __stack_end = .; } > REGION_STACK AT> REGION_STACK } - -/* RAM region to be used for the nanoFramework CLR managed heap.*/ -REGION_ALIAS("CLR_MANAGED_HEAP_RAM", SRAM); - -/* nanoCLR rules inclusion.*/ -INCLUDE rules_clr.ld - -ENTRY(resetISR) diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/main.c b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/main.c index 9283109b61..b8f9ced6b0 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/main.c +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/main.c @@ -5,63 +5,75 @@ #include #include -// POSIX Header files -#include -#include // RTOS header files -#include "FreeRTOS.h" -#include "task.h" +#include +#include +#include +#include // board Header files -#include "Board.h" +#include ////////////////////////////// // Stack size in bytes -#define THREADSTACKSIZE 2024 +#define THREADSTACKSIZE 2048 -extern void * mainThread(void *arg0); +Task_Handle receiverHandle; +Task_Handle clrHandle; + +CLR_SETTINGS clrSettings; + +extern void ReceiverThread(UArg arg0, UArg arg1); +extern void CLRStartupThread(UArg arg0, UArg arg1); int main(void) { - pthread_t thread; - pthread_attr_t threadAttributes; - struct sched_param priorityParameters; - - int retc; + Task_Params taskParams; // Call board init functions Board_initGeneral(); - // CLR settings to launch CLR thread - CLR_SETTINGS clrSettings; + // setup Task thread + Task_Params_init(&taskParams); + taskParams.stackSize = THREADSTACKSIZE; + taskParams.priority = 4; + + // create Receiver + receiverHandle = Task_create((Task_FuncPtr)ReceiverThread, &taskParams, Error_IGNORE); + if (receiverHandle == NULL) + { + while (1); + } + + // CLR settings to launch CLR thread (void)memset(&clrSettings, 0, sizeof(CLR_SETTINGS)); clrSettings.MaxContextSwitches = 50; clrSettings.WaitForDebugger = false; clrSettings.EnterDebuggerLoopAfterExit = true; - // Set priority and stack size attributes - pthread_attr_init(&threadAttributes); - priorityParameters.sched_priority = 1; - - retc = pthread_attr_setdetachstate(&threadAttributes, PTHREAD_CREATE_DETACHED); - - pthread_attr_setschedparam(&threadAttributes, &priorityParameters); - retc |= pthread_attr_setstacksize(&threadAttributes, THREADSTACKSIZE); - retc |= pthread_create(&thread, &threadAttributes, mainThread, &clrSettings); - if(retc != 0) + // setup CLR task + taskParams.arg0 = (UArg)&clrSettings; + taskParams.stackSize = THREADSTACKSIZE; + taskParams.priority = 4; + clrHandle = Task_create(CLRStartupThread, &taskParams, Error_IGNORE); + if (clrHandle == NULL) { - // pthread_create() - while(1) - { - ; - } + while (1); } - // Start the FreeRTOS scheduler - vTaskStartScheduler(); + GPIO_init(); + UART_init(); + ConfigUART(); + + // Switch off all LEDs on board + GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_OFF); + GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_OFF); + GPIO_write(Board_GPIO_LED2, Board_GPIO_LED_OFF); + + BIOS_start(); return (0); } diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/target_BlockStorage.h b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/target_BlockStorage.h index 74d115d382..aa50b1b7f2 100644 --- a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/target_BlockStorage.h +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/target_BlockStorage.h @@ -6,7 +6,7 @@ #ifndef _TARGETPAL_BLOCKSTORAGE_H_ #define _TARGETPAL_BLOCKSTORAGE_H_ 1 -// this device has 2 block storage devices -#define TARGET_BLOCKSTORAGE_COUNT 2 +// this device has 1 block storage devices +#define TARGET_BLOCKSTORAGE_COUNT 1 #endif //_TARGETPAL_BLOCKSTORAGE_H_ diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-debug.cfg b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-debug.cfg new file mode 100644 index 0000000000..53a2c5f1b5 --- /dev/null +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-debug.cfg @@ -0,0 +1,574 @@ +/* + * Copyright (c) 2015-2017, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + + +/* ================ Clock configuration ================ */ +var Clock = xdc.useModule('ti.sysbios.knl.Clock'); +/* + * Default value is family dependent. For example, Linux systems often only + * support a minimum period of 10000 us and multiples of 10000 us. + * TI platforms have a default of 1000 us. + */ +Clock.tickPeriod = 1000; + + + +/* ================ Defaults (module) configuration ================ */ +var Defaults = xdc.useModule('xdc.runtime.Defaults'); +/* + * A flag to allow module names to be loaded on the target. Module name + * strings are placed in the .const section for debugging purposes. + * + * Pick one: + * - true (default) + * Setting this parameter to true will include name strings in the .const + * section so that Errors and Asserts are easier to debug. + * - false + * Setting this parameter to false will reduce footprint in the .const + * section. As a result, Error and Assert messages will contain an + * "unknown module" prefix instead of the actual module name. + */ +Defaults.common$.namedModule = true; +//Defaults.common$.namedModule = false; + + + +/* ================ Error configuration ================ */ +var Error = xdc.useModule('xdc.runtime.Error'); +/* + * This function is called to handle all raised errors, but unlike + * Error.raiseHook, this function is responsible for completely handling the + * error with an appropriately initialized Error_Block. + * + * Pick one: + * - Error.policyDefault (default) + * Calls Error.raiseHook with an initialized Error_Block structure and logs + * the error using the module's logger. + * - Error.policySpin + * Simple alternative that traps on a while(1) loop for minimized target + * footprint. + * Using Error.policySpin, the Error.raiseHook will NOT called. + * - Error.policyMin + * Lightweight policy function that does minimum processing and returns. + */ +Error.policyFxn = Error.policyDefault; +//Error.policyFxn = Error.policySpin; +//Error.policyFxn = Error.policyMin; + +/* + * If Error.policyFxn is set to Error.policyDefault, this function is called + * whenever an error is raised by the Error module. + * + * Pick one: + * - Error.print (default) + * Errors are formatted and output via System_printf() for easier + * debugging. + * - null + * Errors are not formatted or logged. This option reduces code footprint. + * - non-null function + * Errors invoke custom user function. See the Error module documentation + * for more details. + */ +Error.raiseHook = Error.print; +//Error.raiseHook = null; +//Error.raiseHook = "&myErrorFxn"; + +/* + * If Error.policyFxn is set to Error.policyDefault, this option applies to the + * maximum number of times the Error.raiseHook function can be recursively + * invoked. This option limits the possibility of an infinite recursion that + * could lead to a stack overflow. + * The default value is 16. + */ +Error.maxDepth = 2; + + + +/* ================ Hwi configuration ================ */ +var halHwi = xdc.useModule('ti.sysbios.hal.Hwi'); +var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi'); +/* + * Checks for Hwi (system) stack overruns while in the Idle loop. + * + * Pick one: + * - true (default) + * Checks the top word for system stack overflows during the idle loop and + * raises an Error if one is detected. + * - false + * Disabling the runtime check improves runtime performance and yields a + * reduced flash footprint. + */ +halHwi.checkStackFlag = true; +//halHwi.checkStackFlag = false; + +/* + * The following options alter the system's behavior when a hardware exception + * is detected. + * + * Pick one: + * - Hwi.enableException = true + * This option causes the default m3Hwi.excHandlerFunc function to fully + * decode an exception and dump the registers to the system console. + * This option raises errors in the Error module and displays the + * exception in ROV. + * - Hwi.enableException = false + * This option reduces code footprint by not decoding or printing the + * exception to the system console. + * It however still raises errors in the Error module and displays the + * exception in ROV. + * - Hwi.excHandlerFunc = null + * This is the most aggressive option for code footprint savings; but it + * can difficult to debug exceptions. It reduces flash footprint by + * plugging in a default while(1) trap when exception occur. This option + * does not raise an error with the Error module. + */ +m3Hwi.enableException = true; +//m3Hwi.enableException = false; +//m3Hwi.excHandlerFunc = null; + +/* + * Enable hardware exception generation when dividing by zero. + * + * Pick one: + * - 0 (default) + * Disables hardware exceptions when dividing by zero + * - 1 + * Enables hardware exceptions when dividing by zero + */ +m3Hwi.nvicCCR.DIV_0_TRP = 0; +//m3Hwi.nvicCCR.DIV_0_TRP = 1; + + + +/* ================ Idle configuration ================ */ +var Idle = xdc.useModule('ti.sysbios.knl.Idle'); +/* + * The Idle module is used to specify a list of functions to be called when no + * other tasks are running in the system. + * + * Functions added here will be run continuously within the idle task. + * + * Function signature: + * Void func(Void); + */ +//Idle.addFunc("&myIdleFunc"); + +Idle.addFunc('&Power_idleFunc'); /* add the Power module's idle function */ + + + +/* ================ Kernel (SYS/BIOS) configuration ================ */ +var BIOS = xdc.useModule('ti.sysbios.BIOS'); +/* + * Enable asserts in the BIOS library. + * + * Pick one: + * - true (default) + * Enables asserts for debugging purposes. + * - false + * Disables asserts for a reduced code footprint and better performance. + */ +BIOS.assertsEnabled = true; +//BIOS.assertsEnabled = false; + +/* + * A flag to determine if xdc.runtime sources are to be included in a custom + * built BIOS library. + * + * Pick one: + * - false (default) + * The pre-built xdc.runtime library is provided by the respective target + * used to build the application. + * - true + * xdc.runtime library sources are to be included in the custom BIOS + * library. This option yields the most efficient library in both code + * footprint and runtime performance. + */ +//BIOS.includeXdcRuntime = false; +BIOS.includeXdcRuntime = true; + +/* + * The SYS/BIOS runtime is provided in the form of a library that is linked + * with the application. Several forms of this library are provided with the + * SYS/BIOS product. + * + * Pick one: + * - BIOS.LibType_Custom + * Custom built library that is highly optimized for code footprint and + * runtime performance. + * - BIOS.LibType_Debug + * Custom built library that is non-optimized that can be used to + * single-step through APIs with a debugger. + * + */ +BIOS.libType = BIOS.LibType_Custom; +//BIOS.libType = BIOS.LibType_Debug; + +/* + * Runtime instance creation enable flag. + * + * Pick one: + * - true (default) + * Allows Mod_create() and Mod_delete() to be called at runtime which + * requires a default heap for dynamic memory allocation. + * - false + * Reduces code footprint by disallowing Mod_create() and Mod_delete() to + * be called at runtime. Object instances are constructed via + * Mod_construct() and destructed via Mod_destruct(). + */ +BIOS.runtimeCreatesEnabled = true; +//BIOS.runtimeCreatesEnabled = false; + +/* + * Enable logs in the BIOS library. + * + * Pick one: + * - true (default) + * Enables logs for debugging purposes. + * - false + * Disables logging for reduced code footprint and improved runtime + * performance. + */ +BIOS.logsEnabled = true; +//BIOS.logsEnabled = false; + + + +/* ================ Memory configuration ================ */ +var Memory = xdc.useModule('xdc.runtime.Memory'); +/* + * The Memory module itself simply provides a common interface for any + * variety of system and application specific memory management policies + * implemented by the IHeap modules(Ex. HeapMem, HeapBuf). + */ + +/* + * Use HeapMem primary heap instance to use linker-defined memory region + * Add HeapTrack on top to find over-writes, invalid frees, and + * aid in finding the correct sizing of the heap and memory leaks. + */ +var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); +HeapMem.primaryHeapBaseAddr = "&__primary_heap_start__"; +HeapMem.primaryHeapEndAddr = "&__primary_heap_end__"; + +var heapMemParams = new HeapMem.Params(); +heapMemParams.usePrimaryHeap = true; + +var HeapTrack = xdc.useModule('ti.sysbios.heaps.HeapTrack'); +var heapTrackParams = new HeapTrack.Params; +heapTrackParams.heap = HeapMem.create(heapMemParams); +Program.global.heap0 = HeapTrack.create(heapTrackParams); +//Program.global.heap0 = HeapMem.create(heapMemParams); + +Memory.defaultHeapInstance = Program.global.heap0; + + +/* ================ Program configuration ================ */ +/* + * Program.stack must be set to 0 to allow the setting + * of the system stack size to be determined in the example's + * linker command file. + */ +Program.stack = 0; + + +/* + * Uncomment to enable Semihosting for GNU targets to print to the CCS console. + * Please read the following TIRTOS Wiki page for more information on Semihosting: + * http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SemiHosting + */ + +if (Program.build.target.$name.match(/gnu/)) { + //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport'); +} + + + +/* ================ Semaphore configuration ================ */ +var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); +/* + * Enables global support for Task priority pend queuing. + * + * Pick one: + * - true (default) + * This allows pending tasks to be serviced based on their task priority. + * - false + * Pending tasks are services based on first in, first out basis. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//Semaphore.supportsPriority = true; +Semaphore.supportsPriority = false; + +/* + * Allows for the implicit posting of events through the semaphore, + * disable for additional code saving. + * + * Pick one: + * - true + * This allows the Semaphore module to post semaphores and events + * simultaneously. + * - false (default) + * Events must be explicitly posted to unblock tasks. + * + */ +//Semaphore.supportsEvents = true; +Semaphore.supportsEvents = false; + + + +/* ================ Swi configuration ================ */ +var Swi = xdc.useModule('ti.sysbios.knl.Swi'); +/* + * A software interrupt is an object that encapsulates a function to be + * executed and a priority. Software interrupts are prioritized, preempt tasks + * and are preempted by hardware interrupt service routines. + * + * This module is included to allow Swi's in a users' application. + */ + + + +/* ================ System configuration ================ */ +var System = xdc.useModule('xdc.runtime.System'); +/* + * The Abort handler is called when the system exits abnormally. + * + * Pick one: + * - System.abortStd (default) + * Call the ANSI C Standard 'abort()' to terminate the application. + * - System.abortSpin + * A lightweight abort function that loops indefinitely in a while(1) trap + * function. + * - A custom abort handler + * A user-defined function. See the System module documentation for + * details. + */ +System.abortFxn = System.abortStd; +//System.abortFxn = System.abortSpin; +//System.abortFxn = "&myAbortSystem"; + +/* + * The Exit handler is called when the system exits normally. + * + * Pick one: + * - System.exitStd (default) + * Call the ANSI C Standard 'exit()' to terminate the application. + * - System.exitSpin + * A lightweight exit function that loops indefinitely in a while(1) trap + * function. + * - A custom exit function + * A user-defined function. See the System module documentation for + * details. + */ +System.exitFxn = System.exitStd; +//System.exitFxn = System.exitSpin; +//System.exitFxn = "&myExitSystem"; + +/* + * Minimize exit handler array in the System module. The System module includes + * an array of functions that are registered with System_atexit() which is + * called by System_exit(). The default value is 8. + */ +System.maxAtexitHandlers = 2; + +/* + * Enable System_printf() to display floats. Use the longer '%f%$L%$S%$F' + * if your code has SYS/BIOS instrumentation enabled (Asserts/Error/Log), + * as is typical with the 'debug' profile. + */ +System.extendedFormats = '%f%$L%$S%$F'; +//System.extendedFormats = '%f%$S'; + +/* + * The System.SupportProxy defines a low-level implementation of System + * functions such as System_printf(), System_flush(), etc. + * + * Pick one pair: + * - SysMin + * This module maintains an internal configurable circular buffer that + * stores the output until System_flush() is called. + * The size of the circular buffer is set via SysMin.bufSize. + * - SysCallback + * SysCallback allows for user-defined implementations for System APIs. + * The SysCallback support proxy has a smaller code footprint and can be + * used to supply custom System_printf services. + * The default SysCallback functions point to stub functions. See the + * SysCallback module's documentation. + */ +var SysMin = xdc.useModule('xdc.runtime.SysMin'); +SysMin.bufSize = 1024; +System.SupportProxy = SysMin; +//var SysCallback = xdc.useModule('xdc.runtime.SysCallback'); +//System.SupportProxy = SysCallback; +//SysCallback.abortFxn = "&myUserAbort"; +//SysCallback.exitFxn = "&myUserExit"; +//SysCallback.flushFxn = "&myUserFlush"; +//SysCallback.putchFxn = "&myUserPutch"; +//SysCallback.readyFxn = "&myUserReady"; + + + +/* ================ Task configuration ================ */ +var Task = xdc.useModule('ti.sysbios.knl.Task'); +/* + * Check task stacks for overflow conditions. + * + * Pick one: + * - true (default) + * Enables runtime checks for task stack overflow conditions during + * context switching ("from" and "to") + * - false + * Disables runtime checks for task stack overflow conditions. + */ +Task.checkStackFlag = true; +//Task.checkStackFlag = false; + +/* + * Set the default task stack size when creating tasks. + * + * The default is dependent on the device being used. Reducing the default stack + * size yields greater memory savings. + */ +Task.defaultStackSize = 512; + +/* + * Enables the idle task. + * + * Pick one: + * - true (default) + * Creates a task with priority of 0 which calls idle hook functions. This + * option must be set to true to gain power savings provided by the Power + * module. + * - false + * No idle task is created. This option consumes less memory as no + * additional default task stack is needed. + * To gain power savings by the Power module without having the idle task, + * add Idle.run as the Task.allBlockedFunc. + */ +Task.enableIdleTask = true; +//Task.enableIdleTask = false; +//Task.allBlockedFunc = Idle.run; + +/* + * If Task.enableIdleTask is set to true, this option sets the idle task's + * stack size. + * + * Reducing the idle stack size yields greater memory savings. + */ +Task.idleTaskStackSize = 512; + +/* + * Reduce the number of task priorities. + * The default is 16. + * Decreasing the number of task priorities yield memory savings. + */ +Task.numPriorities = 16; + + + +/* ================ Text configuration ================ */ +var Text = xdc.useModule('xdc.runtime.Text'); +/* + * These strings are placed in the .const section. Setting this parameter to + * false will save space in the .const section. Error, Assert and Log messages + * will print raw ids and args instead of a formatted message. + * + * Pick one: + * - true (default) + * This option loads test string into the .const for easier debugging. + * - false + * This option reduces the .const footprint. + */ +Text.isLoaded = true; +//Text.isLoaded = false; + + + +/* ================ Types configuration ================ */ +var Types = xdc.useModule('xdc.runtime.Types'); +/* + * This module defines basic constants and types used throughout the + * xdc.runtime package. + */ + + + +/* ================ Application Specific Instances ================ */ + +/* ================ Diagnostics configuration ================ */ +var Diags = xdc.useModule('xdc.runtime.Diags'); +/* + * You use the Diags module to set and clear bits in a module's diagnostics + * mask for the purpose of controlling diagnostics within that module. A + * module diagnostics mask controls both Assert and Log statements + * within that module, disabling these statements yields + * code savings. + */ + +/* ================ Logging configuration ================ */ +var Log = xdc.useModule('xdc.runtime.Log'); +/* + * Modules and the application code generate Log_Event events by calling + * the Log module's functions. + * Disabling all Log statements here will allow the optimizer to completely + * remove all Log code from the application. + * + * Note: In order to generate Log events in your application both the Diags + * and the Log mask must be set. See the SYS/BIOS API guide for + * more information. + */ + +/* + * LoggingSetup configures TI-RTOS modules to capture user-specified information + * such as CPU Load, Task Load and Task Execution so that it can be + * displayed by System Analyzer. + */ +var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup'); +LoggingSetup.loadLoggerSize = 256; +LoggingSetup.mainLoggerSize = 512; +LoggingSetup.sysbiosLoggerSize = 1024; + +/* ================ Main configuration ================ */ +var Main = xdc.useModule('xdc.runtime.Main'); +/* Configuration of this Main module is used for all code not in a module */ + +/* ================ POSIX configuration ================ */ +var Settings = xdc.useModule('ti.posix.tirtos.Settings'); + +/* ================ Event configuration ================ */ +var Event = xdc.useModule('ti.sysbios.knl.Event'); + +/* ================ Mailbox configuration ================ */ +var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox'); diff --git a/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-release.cfg b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-release.cfg new file mode 100644 index 0000000000..ecac87c7d5 --- /dev/null +++ b/targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-release.cfg @@ -0,0 +1,574 @@ +/* + * Copyright (c) 2015-2017, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + + +/* ================ Clock configuration ================ */ +var Clock = xdc.useModule('ti.sysbios.knl.Clock'); +/* + * Default value is family dependent. For example, Linux systems often only + * support a minimum period of 10000 us and multiples of 10000 us. + * TI platforms have a default of 1000 us. + */ +Clock.tickPeriod = 1000; + + + +/* ================ Defaults (module) configuration ================ */ +var Defaults = xdc.useModule('xdc.runtime.Defaults'); +/* + * A flag to allow module names to be loaded on the target. Module name + * strings are placed in the .const section for debugging purposes. + * + * Pick one: + * - true (default) + * Setting this parameter to true will include name strings in the .const + * section so that Errors and Asserts are easier to debug. + * - false + * Setting this parameter to false will reduce footprint in the .const + * section. As a result, Error and Assert messages will contain an + * "unknown module" prefix instead of the actual module name. + */ +//Defaults.common$.namedModule = true; +Defaults.common$.namedModule = false; + + + +/* ================ Error configuration ================ */ +var Error = xdc.useModule('xdc.runtime.Error'); +/* + * This function is called to handle all raised errors, but unlike + * Error.raiseHook, this function is responsible for completely handling the + * error with an appropriately initialized Error_Block. + * + * Pick one: + * - Error.policyDefault (default) + * Calls Error.raiseHook with an initialized Error_Block structure and logs + * the error using the module's logger. + * - Error.policySpin + * Simple alternative that traps on a while(1) loop for minimized target + * footprint. + * Using Error.policySpin, the Error.raiseHook will NOT called. + * - Error.policyMin + * Lightweight policy function that does minimum processing and returns. + */ +//Error.policyFxn = Error.policyDefault; +//Error.policyFxn = Error.policySpin; +Error.policyFxn = Error.policyMin; + +/* + * If Error.policyFxn is set to Error.policyDefault, this function is called + * whenever an error is raised by the Error module. + * + * Pick one: + * - Error.print (default) + * Errors are formatted and output via System_printf() for easier + * debugging. + * - null + * Errors are not formatted or logged. This option reduces code footprint. + * - non-null function + * Errors invoke custom user function. See the Error module documentation + * for more details. + */ +//Error.raiseHook = Error.print; +Error.raiseHook = null; +//Error.raiseHook = "&myErrorFxn"; + +/* + * If Error.policyFxn is set to Error.policyDefault, this option applies to the + * maximum number of times the Error.raiseHook function can be recursively + * invoked. This option limits the possibility of an infinite recursion that + * could lead to a stack overflow. + * The default value is 16. + */ +Error.maxDepth = 2; + + + +/* ================ Hwi configuration ================ */ +var halHwi = xdc.useModule('ti.sysbios.hal.Hwi'); +var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi'); +/* + * Checks for Hwi (system) stack overruns while in the Idle loop. + * + * Pick one: + * - true (default) + * Checks the top word for system stack overflows during the idle loop and + * raises an Error if one is detected. + * - false + * Disabling the runtime check improves runtime performance and yields a + * reduced flash footprint. + */ +//halHwi.checkStackFlag = true; +halHwi.checkStackFlag = false; + +/* + * The following options alter the system's behavior when a hardware exception + * is detected. + * + * Pick one: + * - Hwi.enableException = true + * This option causes the default m3Hwi.excHandlerFunc function to fully + * decode an exception and dump the registers to the system console. + * This option raises errors in the Error module and displays the + * exception in ROV. + * - Hwi.enableException = false + * This option reduces code footprint by not decoding or printing the + * exception to the system console. + * It however still raises errors in the Error module and displays the + * exception in ROV. + * - Hwi.excHandlerFunc = null + * This is the most aggressive option for code footprint savings; but it + * can difficult to debug exceptions. It reduces flash footprint by + * plugging in a default while(1) trap when exception occur. This option + * does not raise an error with the Error module. + */ +//m3Hwi.enableException = true; +//m3Hwi.enableException = false; +m3Hwi.excHandlerFunc = null; + +/* + * Enable hardware exception generation when dividing by zero. + * + * Pick one: + * - 0 (default) + * Disables hardware exceptions when dividing by zero + * - 1 + * Enables hardware exceptions when dividing by zero + */ +m3Hwi.nvicCCR.DIV_0_TRP = 0; +//m3Hwi.nvicCCR.DIV_0_TRP = 1; + + + +/* ================ Idle configuration ================ */ +var Idle = xdc.useModule('ti.sysbios.knl.Idle'); +/* + * The Idle module is used to specify a list of functions to be called when no + * other tasks are running in the system. + * + * Functions added here will be run continuously within the idle task. + * + * Function signature: + * Void func(Void); + */ +//Idle.addFunc("&myIdleFunc"); + +Idle.addFunc('&Power_idleFunc'); /* add the Power module's idle function */ + + + +/* ================ Kernel (SYS/BIOS) configuration ================ */ +var BIOS = xdc.useModule('ti.sysbios.BIOS'); +/* + * Enable asserts in the BIOS library. + * + * Pick one: + * - true (default) + * Enables asserts for debugging purposes. + * - false + * Disables asserts for a reduced code footprint and better performance. + */ +//BIOS.assertsEnabled = true; +BIOS.assertsEnabled = false; + +/* + * A flag to determine if xdc.runtime sources are to be included in a custom + * built BIOS library. + * + * Pick one: + * - false (default) + * The pre-built xdc.runtime library is provided by the respective target + * used to build the application. + * - true + * xdc.runtime library sources are to be included in the custom BIOS + * library. This option yields the most efficient library in both code + * footprint and runtime performance. + */ +//BIOS.includeXdcRuntime = false; +BIOS.includeXdcRuntime = true; + +/* + * The SYS/BIOS runtime is provided in the form of a library that is linked + * with the application. Several forms of this library are provided with the + * SYS/BIOS product. + * + * Pick one: + * - BIOS.LibType_Custom + * Custom built library that is highly optimized for code footprint and + * runtime performance. + * - BIOS.LibType_Debug + * Custom built library that is non-optimized that can be used to + * single-step through APIs with a debugger. + * + */ +BIOS.libType = BIOS.LibType_Custom; +//BIOS.libType = BIOS.LibType_Debug; + +/* + * Runtime instance creation enable flag. + * + * Pick one: + * - true (default) + * Allows Mod_create() and Mod_delete() to be called at runtime which + * requires a default heap for dynamic memory allocation. + * - false + * Reduces code footprint by disallowing Mod_create() and Mod_delete() to + * be called at runtime. Object instances are constructed via + * Mod_construct() and destructed via Mod_destruct(). + */ +BIOS.runtimeCreatesEnabled = true; +//BIOS.runtimeCreatesEnabled = false; + +/* + * Enable logs in the BIOS library. + * + * Pick one: + * - true (default) + * Enables logs for debugging purposes. + * - false + * Disables logging for reduced code footprint and improved runtime + * performance. + */ +//BIOS.logsEnabled = true; +BIOS.logsEnabled = false; + + + +/* ================ Memory configuration ================ */ +var Memory = xdc.useModule('xdc.runtime.Memory'); +/* + * The Memory module itself simply provides a common interface for any + * variety of system and application specific memory management policies + * implemented by the IHeap modules(Ex. HeapMem, HeapBuf). + */ + +/* + * Use HeapMem primary heap instance to use linker-defined memory region + * Add HeapTrack on top to find over-writes, invalid frees, and + * aid in finding the correct sizing of the heap and memory leaks. + */ +var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); +HeapMem.primaryHeapBaseAddr = "&__primary_heap_start__"; +HeapMem.primaryHeapEndAddr = "&__primary_heap_end__"; + +var heapMemParams = new HeapMem.Params(); +heapMemParams.usePrimaryHeap = true; + +//var HeapTrack = xdc.useModule('ti.sysbios.heaps.HeapTrack'); +//var heapTrackParams = new HeapTrack.Params; +//heapTrackParams.heap = HeapMem.create(heapMemParams); +//Program.global.heap0 = HeapTrack.create(heapTrackParams); +Program.global.heap0 = HeapMem.create(heapMemParams); + +Memory.defaultHeapInstance = Program.global.heap0; + + +/* ================ Program configuration ================ */ +/* + * Program.stack must be set to 0 to allow the setting + * of the system stack size to be determined in the example's + * linker command file. + */ +Program.stack = 0; + + +/* + * Uncomment to enable Semihosting for GNU targets to print to the CCS console. + * Please read the following TIRTOS Wiki page for more information on Semihosting: + * http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SemiHosting + */ + +if (Program.build.target.$name.match(/gnu/)) { + //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport'); +} + + + +/* ================ Semaphore configuration ================ */ +var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); +/* + * Enables global support for Task priority pend queuing. + * + * Pick one: + * - true (default) + * This allows pending tasks to be serviced based on their task priority. + * - false + * Pending tasks are services based on first in, first out basis. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//Semaphore.supportsPriority = true; +Semaphore.supportsPriority = false; + +/* + * Allows for the implicit posting of events through the semaphore, + * disable for additional code saving. + * + * Pick one: + * - true + * This allows the Semaphore module to post semaphores and events + * simultaneously. + * - false (default) + * Events must be explicitly posted to unblock tasks. + * + */ +//Semaphore.supportsEvents = true; +Semaphore.supportsEvents = false; + + + +/* ================ Swi configuration ================ */ +var Swi = xdc.useModule('ti.sysbios.knl.Swi'); +/* + * A software interrupt is an object that encapsulates a function to be + * executed and a priority. Software interrupts are prioritized, preempt tasks + * and are preempted by hardware interrupt service routines. + * + * This module is included to allow Swi's in a users' application. + */ + + + +/* ================ System configuration ================ */ +var System = xdc.useModule('xdc.runtime.System'); +/* + * The Abort handler is called when the system exits abnormally. + * + * Pick one: + * - System.abortStd (default) + * Call the ANSI C Standard 'abort()' to terminate the application. + * - System.abortSpin + * A lightweight abort function that loops indefinitely in a while(1) trap + * function. + * - A custom abort handler + * A user-defined function. See the System module documentation for + * details. + */ +//System.abortFxn = System.abortStd; +System.abortFxn = System.abortSpin; +//System.abortFxn = "&myAbortSystem"; + +/* + * The Exit handler is called when the system exits normally. + * + * Pick one: + * - System.exitStd (default) + * Call the ANSI C Standard 'exit()' to terminate the application. + * - System.exitSpin + * A lightweight exit function that loops indefinitely in a while(1) trap + * function. + * - A custom exit function + * A user-defined function. See the System module documentation for + * details. + */ +//System.exitFxn = System.exitStd; +System.exitFxn = System.exitSpin; +//System.exitFxn = "&myExitSystem"; + +/* + * Minimize exit handler array in the System module. The System module includes + * an array of functions that are registered with System_atexit() which is + * called by System_exit(). The default value is 8. + */ +System.maxAtexitHandlers = 2; + +/* + * Enable System_printf() to display floats. Use the longer '%f%$L%$S%$F' + * if your code has SYS/BIOS instrumentation enabled (Asserts/Error/Log), + * as is typical with the 'debug' profile. + */ +//System.extendedFormats = '%f%$L%$S%$F'; +System.extendedFormats = '%f%$S'; + +/* + * The System.SupportProxy defines a low-level implementation of System + * functions such as System_printf(), System_flush(), etc. + * + * Pick one pair: + * - SysMin + * This module maintains an internal configurable circular buffer that + * stores the output until System_flush() is called. + * The size of the circular buffer is set via SysMin.bufSize. + * - SysCallback + * SysCallback allows for user-defined implementations for System APIs. + * The SysCallback support proxy has a smaller code footprint and can be + * used to supply custom System_printf services. + * The default SysCallback functions point to stub functions. See the + * SysCallback module's documentation. + */ +//var SysMin = xdc.useModule('xdc.runtime.SysMin'); +//SysMin.bufSize = 1024; +//System.SupportProxy = SysMin; +var SysCallback = xdc.useModule('xdc.runtime.SysCallback'); +System.SupportProxy = SysCallback; +//SysCallback.abortFxn = "&myUserAbort"; +//SysCallback.exitFxn = "&myUserExit"; +//SysCallback.flushFxn = "&myUserFlush"; +//SysCallback.putchFxn = "&myUserPutch"; +//SysCallback.readyFxn = "&myUserReady"; + + + +/* ================ Task configuration ================ */ +var Task = xdc.useModule('ti.sysbios.knl.Task'); +/* + * Check task stacks for overflow conditions. + * + * Pick one: + * - true (default) + * Enables runtime checks for task stack overflow conditions during + * context switching ("from" and "to") + * - false + * Disables runtime checks for task stack overflow conditions. + */ +//Task.checkStackFlag = true; +Task.checkStackFlag = false; + +/* + * Set the default task stack size when creating tasks. + * + * The default is dependent on the device being used. Reducing the default stack + * size yields greater memory savings. + */ +Task.defaultStackSize = 512; + +/* + * Enables the idle task. + * + * Pick one: + * - true (default) + * Creates a task with priority of 0 which calls idle hook functions. This + * option must be set to true to gain power savings provided by the Power + * module. + * - false + * No idle task is created. This option consumes less memory as no + * additional default task stack is needed. + * To gain power savings by the Power module without having the idle task, + * add Idle.run as the Task.allBlockedFunc. + */ +Task.enableIdleTask = true; +//Task.enableIdleTask = false; +//Task.allBlockedFunc = Idle.run; + +/* + * If Task.enableIdleTask is set to true, this option sets the idle task's + * stack size. + * + * Reducing the idle stack size yields greater memory savings. + */ +Task.idleTaskStackSize = 512; + +/* + * Reduce the number of task priorities. + * The default is 16. + * Decreasing the number of task priorities yield memory savings. + */ +Task.numPriorities = 16; + + + +/* ================ Text configuration ================ */ +var Text = xdc.useModule('xdc.runtime.Text'); +/* + * These strings are placed in the .const section. Setting this parameter to + * false will save space in the .const section. Error, Assert and Log messages + * will print raw ids and args instead of a formatted message. + * + * Pick one: + * - true (default) + * This option loads test string into the .const for easier debugging. + * - false + * This option reduces the .const footprint. + */ +//Text.isLoaded = true; +Text.isLoaded = false; + + + +/* ================ Types configuration ================ */ +var Types = xdc.useModule('xdc.runtime.Types'); +/* + * This module defines basic constants and types used throughout the + * xdc.runtime package. + */ + + + +/* ================ Application Specific Instances ================ */ + +/* ================ Diagnostics configuration ================ */ +//var Diags = xdc.useModule('xdc.runtime.Diags'); +/* + * You use the Diags module to set and clear bits in a module's diagnostics + * mask for the purpose of controlling diagnostics within that module. A + * module diagnostics mask controls both Assert and Log statements + * within that module, disabling these statements yields + * code savings. + */ + +/* ================ Logging configuration ================ */ +//var Log = xdc.useModule('xdc.runtime.Log'); +/* + * Modules and the application code generate Log_Event events by calling + * the Log module's functions. + * Disabling all Log statements here will allow the optimizer to completely + * remove all Log code from the application. + * + * Note: In order to generate Log events in your application both the Diags + * and the Log mask must be set. See the SYS/BIOS API guide for + * more information. + */ + +/* + * LoggingSetup configures TI-RTOS modules to capture user-specified information + * such as CPU Load, Task Load and Task Execution so that it can be + * displayed by System Analyzer. + */ +//var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup'); +//LoggingSetup.loadLoggerSize = 256; +//LoggingSetup.mainLoggerSize = 512; +//LoggingSetup.sysbiosLoggerSize = 1024; + +/* ================ Main configuration ================ */ +var Main = xdc.useModule('xdc.runtime.Main'); +/* Configuration of this Main module is used for all code not in a module */ + +/* ================ POSIX configuration ================ */ +var Settings = xdc.useModule('ti.posix.tirtos.Settings'); + +/* ================ Event configuration ================ */ +var Event = xdc.useModule('ti.sysbios.knl.Event'); + +/* ================ Mailbox configuration ================ */ +var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox'); diff --git a/targets/TI-SimpleLink/common/CMakeLists.txt b/targets/TI-SimpleLink/common/CMakeLists.txt index 5a4de78d45..c441452103 100644 --- a/targets/TI-SimpleLink/common/CMakeLists.txt +++ b/targets/TI-SimpleLink/common/CMakeLists.txt @@ -9,8 +9,6 @@ list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/pla list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_ReceiverThread.c") list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_HAL_Interface.c") -# list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS-openocd.c") - list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/GenericPort.cpp") list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/syscalls.c") # list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/nanoSupport_CRC32.c") diff --git a/targets/TI-SimpleLink/common/FreeRTOS-openocd.c b/targets/TI-SimpleLink/common/FreeRTOS-openocd.c deleted file mode 100644 index 81a3ab77ab..0000000000 --- a/targets/TI-SimpleLink/common/FreeRTOS-openocd.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Since at least FreeRTOS V7.5.3 uxTopUsedPriority is no longer - * present in the kernel, so it has to be supplied by other means for - * OpenOCD's threads awareness. - * - * Add this file to your project, and, if you're using --gc-sections, - * ``--undefined=uxTopUsedPriority'' (or - * ``-Wl,--undefined=uxTopUsedPriority'' when using gcc for final - * linking) to your LDFLAGS; same with all the other symbols you need. - */ - -#include "FreeRTOS.h" - -#ifdef __GNUC__ -#define USED __attribute__((used)) -#else -#define USED -#endif - -const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1; diff --git a/targets/TI-SimpleLink/common/WireProtocol_ReceiverThread.c b/targets/TI-SimpleLink/common/WireProtocol_ReceiverThread.c index f7db420f0f..1b85bf9775 100644 --- a/targets/TI-SimpleLink/common/WireProtocol_ReceiverThread.c +++ b/targets/TI-SimpleLink/common/WireProtocol_ReceiverThread.c @@ -6,8 +6,6 @@ #include "WireProtocol_HAL_Interface.h" #include #include -// #include -// #include extern WP_Message inboundMessage; diff --git a/targets/TI-SimpleLink/common/platformHAL_Time.cpp b/targets/TI-SimpleLink/common/platformHAL_Time.cpp index 01954276f2..11adb03976 100644 --- a/targets/TI-SimpleLink/common/platformHAL_Time.cpp +++ b/targets/TI-SimpleLink/common/platformHAL_Time.cpp @@ -4,9 +4,10 @@ // #include + #include -// Converts FreeRTOS Tickcount to .NET ticks (100 nanoseconds) +// Converts TI RTOS clock tick period to .NET ticks (100 nanoseconds) uint64_t HAL_Time_SysTicksToTime(unsigned int sysTicks) { return ((int64_t)sysTicks * (int64_t)Clock_tickPeriod) * 10; diff --git a/targets/TI-SimpleLink/nanoCLR/targetHAL_Time.cpp b/targets/TI-SimpleLink/nanoCLR/targetHAL_Time.cpp index 3f76032757..63cd53a562 100644 --- a/targets/TI-SimpleLink/nanoCLR/targetHAL_Time.cpp +++ b/targets/TI-SimpleLink/nanoCLR/targetHAL_Time.cpp @@ -10,6 +10,7 @@ #include // #include // #include +#include #include #include @@ -122,5 +123,6 @@ const char* HAL_Time_CurrentDateTimeToString() uint64_t CPU_MillisecondsToTicks(uint64_t ticks) { - return ((ticks * (uint64_t)1000) / Clock_tickPeriod); + //return ((ticks * (uint64_t)configTICK_RATE_HZ) / 1000); + return ((ticks * (uint64_t)Clock_tickPeriod) / 1000); } diff --git a/targets/TI-SimpleLink/nanoCLR/targetPAL_Events.cpp b/targets/TI-SimpleLink/nanoCLR/targetPAL_Events.cpp index 163c3c73fa..4586c2848a 100644 --- a/targets/TI-SimpleLink/nanoCLR/targetPAL_Events.cpp +++ b/targets/TI-SimpleLink/nanoCLR/targetPAL_Events.cpp @@ -7,8 +7,6 @@ #include #include #include -// #include -// #include #include #include #include @@ -16,13 +14,11 @@ uint64_t CPU_MillisecondsToTicks(uint64_t ticks); // timer for bool events -// static TimerHandle_t boolEventsTimer; static Clock_Handle boolEventsTimer; static bool* saveTimerCompleteFlag = 0; volatile uint32_t systemEvents; -// static void local_Events_SetBoolTimer_Callback( TimerHandle_t xTimer ); static void local_Events_SetBoolTimer_Callback( UArg arg ); set_Event_Callback g_Event_Callback = NULL; @@ -37,7 +33,6 @@ bool Events_Initialize() systemEvents = 0; GLOBAL_UNLOCK(); - // boolEventsTimer = xTimerCreate( "boolEventsTimer", 10, pdFALSE, (void *)0, local_Events_SetBoolTimer_Callback); Clock_Params params; Clock_Params_init(¶ms); @@ -54,7 +49,6 @@ bool Events_Uninitialize() { NATIVE_PROFILE_PAL_EVENTS(); - // xTimerDelete(boolEventsTimer,0); Clock_stop(boolEventsTimer); return true; @@ -97,18 +91,13 @@ uint32_t Events_MaskedRead( uint32_t eventsOfInterest ) return (systemEvents & eventsOfInterest); } -// static void local_Events_SetBoolTimer_Callback( TimerHandle_t xTimer ) static void local_Events_SetBoolTimer_Callback( UArg arg ) { NATIVE_PROFILE_PAL_EVENTS(); (void)arg; - // bool* timerCompleteFlag = (bool*)pvTimerGetTimerID( xTimer ); - // *timerCompleteFlag = true; *saveTimerCompleteFlag = true; - - //Clock_stop(boolEventsTimer); } void Events_SetCallback( set_Event_Callback pfn, void* arg ) @@ -124,14 +113,10 @@ void Events_SetBoolTimer( bool* timerCompleteFlag, uint32_t millisecondsFromNow NATIVE_PROFILE_PAL_EVENTS(); // we assume only 1 can be active, abort previous just in case - // xTimerStop( boolEventsTimer, 0 ); Clock_stop(boolEventsTimer); if(timerCompleteFlag != NULL) { - // vTimerSetTimerID( boolEventsTimer, (void*) timerCompleteFlag ); - // xTimerChangePeriod( boolEventsTimer, millisecondsFromNow / portTICK_PERIOD_MS, 0 ); - // As only one timer running at a time we will just save it saveTimerCompleteFlag = timerCompleteFlag; diff --git a/targets/TI-SimpleLink/nanoCLR/targetPAL_Time.cpp b/targets/TI-SimpleLink/nanoCLR/targetPAL_Time.cpp index d3bcb86773..75b3cb0556 100644 --- a/targets/TI-SimpleLink/nanoCLR/targetPAL_Time.cpp +++ b/targets/TI-SimpleLink/nanoCLR/targetPAL_Time.cpp @@ -5,20 +5,14 @@ #include #include -// #include -// #include #include #include -// static TimerHandle_t nextEventTimer; static Clock_Handle nextEventTimer; -// static void NextEventTimer_Callback( TimerHandle_t xTimer ) static void NextEventTimer_Callback( UArg arg ) { (void)arg; - - //Clock_stop(nextEventTimer); // this call also schedules the next one, if there is one HAL_COMPLETION::DequeueAndExec(); @@ -26,7 +20,6 @@ static void NextEventTimer_Callback( UArg arg ) HRESULT Time_Initialize() { - // nextEventTimer = xTimerCreate( "NextEventTimer", 10, pdFALSE, (void *)0, NextEventTimer_Callback); Clock_Params params; Clock_Params_init(¶ms); @@ -41,7 +34,6 @@ HRESULT Time_Initialize() HRESULT Time_Uninitialize() { - // xTimerDelete(nextEventTimer, 0); Clock_stop(nextEventTimer); return S_OK; @@ -61,20 +53,19 @@ void Time_SetCompare ( uint64_t compareValueTicks ) } else { - if (HAL_Time_CurrentTime() >= compareValueTicks) + if (HAL_Time_CurrentSysTicks() >= compareValueTicks) { // already missed the event, dequeue and execute immediately HAL_COMPLETION::DequeueAndExec(); } else { - // xTimerStop( nextEventTimer, 0 ); // need to stop the timer, in case it's running Clock_stop(nextEventTimer); // compareValueTicks is the time (in sys ticks) that is being requested to fire an HAL_COMPLETION::DequeueAndExec() // need to subtract the current system time to set when the timer will fire - compareValueTicks -= HAL_Time_CurrentTime(); + compareValueTicks -= HAL_Time_CurrentSysTicks(); if (compareValueTicks == 0) { diff --git a/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Sntp.c b/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Sntp.c index 81fccbc31e..da138f8b54 100644 --- a/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Sntp.c +++ b/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Sntp.c @@ -14,8 +14,9 @@ #include // RTOS header files -#include "FreeRTOS.h" -#include "task.h" +// #include "FreeRTOS.h" +// #include "task.h" +//#include #include #include diff --git a/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Threads.c b/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Threads.c index c6cab4e519..9f64f1c0cd 100644 --- a/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Threads.c +++ b/targets/TI-SimpleLink/nanoCLR/targetSimpleLinkCC32xx_Threads.c @@ -12,10 +12,6 @@ #include #include -// RTOS header files -#include "FreeRTOS.h" -#include "task.h" - // TI-RTOS Header files #include #include @@ -29,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -37,8 +34,6 @@ extern void Status_callback(); extern void Link_callback(bool linkUp); -extern void * CLRStartupThread(void *arg0); -extern void * ReceiverThread(void *arg0); extern void sntp_init(void); // other externals @@ -813,9 +808,9 @@ void * mainThread(void *arg) // receiver thread pthread_attr_init(&threadAttributes); - priorityParams.sched_priority = NF_TASK_PRIORITY + 1; + priorityParams.sched_priority = NF_TASK_PRIORITY; retc = pthread_attr_setschedparam(&threadAttributes, &priorityParams); - retc |= pthread_attr_setstacksize(&threadAttributes, 2048); + retc |= pthread_attr_setstacksize(&threadAttributes, 1024); if (retc != 0) { // failed to set attributes @@ -838,7 +833,7 @@ void * mainThread(void *arg) pthread_attr_init(&threadAttributes); priorityParams.sched_priority = NF_TASK_PRIORITY; retc = pthread_attr_setschedparam(&threadAttributes, &priorityParams); - retc |= pthread_attr_setstacksize(&threadAttributes, 5116); + retc |= pthread_attr_setstacksize(&threadAttributes, 7168); if (retc != 0) { // failed to set attributes @@ -892,14 +887,14 @@ void vApplicationMallocFailedHook() //! \return none //! //***************************************************************************** -void vApplicationStackOverflowHook(TaskHandle_t pxTask, - char *pcTaskName) -{ - //Handle FreeRTOS Stack Overflow - while(1) - { - } -} +// void vApplicationStackOverflowHook(TaskHandle_t pxTask, +// char *pcTaskName) +// { +// //Handle FreeRTOS Stack Overflow +// while(1) +// { +// } +// } void vApplicationTickHook(void) {