Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on TI CC3220SF target #1626

Merged
merged 1 commit into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 , 137 }, // 0x01000800 nanoCLR
{ BlockRange_BLOCKTYPE_DEPLOYMENT , 138, 510 }, // 0x01045000 deployment
{ BlockRange_BLOCKTYPE_CODE , 0 , 143 }, // 0x01000800 nanoCLR
{ BlockRange_BLOCKTYPE_DEPLOYMENT , 144, 510 }, // 0x01048000 deployment
};

const BlockRegionInfo BlockRegions[] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 , 104 }, // 0x01000800 nanoCLR
{ BlockRange_BLOCKTYPE_DEPLOYMENT , 105, 510 }, // 0x01034800 deployment
{ BlockRange_BLOCKTYPE_CODE , 0 , 109 }, // 0x01000800 nanoCLR
{ BlockRange_BLOCKTYPE_DEPLOYMENT , 110, 510 }, // 0x01037000 deployment
};

const BlockRegionInfo BlockRegions[] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
/*
* Copyright (c) 2016-2018, 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.
*/
//
// Copyright (c) 2020 The nanoFramework project contributors
// Copyright (c) 2016-2018, Texas Instruments Incorporated
// See LICENSE file in the project root for full license information.
//
*/

/*
* ======== CC3220SF_LAUNCHXL_TIRTOS.lds ========
Expand All @@ -40,7 +16,7 @@ HEAPSIZE = 0x8000; /* Size of heap buffer used by HeapMem */
MEMORY
{
FLASH_HDR (RX) : ORIGIN = 0x01000000, LENGTH = 0x7FF
FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x045000
FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x048000
SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00040000
}

Expand Down
38 changes: 7 additions & 31 deletions targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/CC3220SF_CLR.ld
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
/*
* Copyright (c) 2016-2018, 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.
*/
//
// Copyright (c) 2020 The nanoFramework project contributors
// Copyright (c) 2016-2018, Texas Instruments Incorporated
// See LICENSE file in the project root for full license information.
//
*/

/*
* ======== CC3220SF_LAUNCHXL_TIRTOS.lds ========
Expand All @@ -40,7 +16,7 @@ HEAPSIZE = 0x8000; /* Size of heap buffer used by HeapMem */
MEMORY
{
FLASH_HDR (RX) : ORIGIN = 0x01000000, LENGTH = 0x7FF
FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x034800
FLASH (RX) : ORIGIN = 0x01000800, LENGTH = 0x037000
SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00040000
}

Expand Down
61 changes: 24 additions & 37 deletions targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/nanoCLR/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#include <stdint.h>
#include <nanoCLR_Application.h>

// POSIX Header files
#include <pthread.h>
#include <unistd.h>

// RTOS header files
#include <xdc/std.h>
#include <xdc/runtime/Error.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

// board Header files
#include <Board.h>
Expand All @@ -20,59 +21,45 @@
// Stack size in bytes
#define THREADSTACKSIZE 2048

Task_Handle receiverHandle;
Task_Handle clrHandle;

CLR_SETTINGS clrSettings;

extern void ReceiverThread(UArg arg0, UArg arg1);
extern void CLRStartupThread(UArg arg0, UArg arg1);
extern void * mainThread(void *arg);

int main(void)
{
Task_Params taskParams;
pthread_t thread;
pthread_attr_t threadAttributes;
struct sched_param priorityParameters;

int retc;

// Call board init functions
Board_initGeneral();

// 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;

// setup CLR task
taskParams.arg0 = (UArg)&clrSettings;
taskParams.stackSize = THREADSTACKSIZE;
taskParams.priority = 4;
clrHandle = Task_create(CLRStartupThread, &taskParams, Error_IGNORE);
if (clrHandle == NULL)
// 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)
{
while (1);
while(1)
{
;
}
}

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);
Expand Down
36 changes: 6 additions & 30 deletions targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-debug.cfg
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
/*
* 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.
*/
//
// Copyright (c) 2020 The nanoFramework project contributors
// Copyright (c) 2016-2018, Texas Instruments Incorporated
// See LICENSE file in the project root for full license information.
//
*/



Expand Down
36 changes: 6 additions & 30 deletions targets/TI-SimpleLink/TI_CC3220SF_LAUNCHXL/ti-rtos-release.cfg
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
/*
* 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.
*/
//
// Copyright (c) 2020 The nanoFramework project contributors
// Copyright (c) 2016-2018, Texas Instruments Incorporated
// See LICENSE file in the project root for full license information.
//
*/



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,10 @@ void * mainThread(void *arg)
// initialize the realtime clock
clock_settime(CLOCK_REALTIME, &ts);

// Switch off all LEDs on boards
// 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);

// clear SimpleLink Status
nF_ControlBlock.Status = 0;
Expand Down Expand Up @@ -810,7 +812,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, 1024);
retc |= pthread_attr_setstacksize(&threadAttributes, THREADSTACKSIZE);
if (retc != 0)
{
// failed to set attributes
Expand All @@ -833,7 +835,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, 7168);
retc |= pthread_attr_setstacksize(&threadAttributes, THREADSTACKSIZE);
if (retc != 0)
{
// failed to set attributes
Expand Down