Commit 40c19fa1 authored by Matthias Wenzl's avatar Matthias Wenzl
Browse files

inital commit

parents
<?xml version="1.0" encoding="UTF-8" ?>
<?ccsproject version="1.0"?>
<projectOptions>
<ccsVersion value="7.2.0"/>
<deviceVariant value="Cortex M.TM4C1294NCPDT"/>
<deviceFamily value="TMS470"/>
<deviceEndianness value="little"/>
<codegenToolVersion value="16.9.3.LTS"/>
<isElfFormat value="true"/>
<connection value="common/targetdb/connections/Stellaris_ICDI_Connection.xml"/>
<rts value="libc.a"/>
<createSlaveProjects value=""/>
<templateProperties value="id=org.eclipse.rtsc.project.templates.EmptyRtscApplication,buildProfile=release,isHybrid=true,"/>
<filesToOpen value=""/>
<isTargetManual value="false"/>
</projectOptions>
This diff is collapsed.
/.config/
Debug/
/.launches/
Release/
/.settings/
/src/
.xdchelp
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tirtos_base_tivac</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.rtsc.xdctools.buildDefinitions.XDC.xdcNature</nature>
<nature>com.ti.ccstudio.core.ccsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
/*
* ======== Blink_Task.c ========
* Author: Michael Kramer / Matthias Wenzl
*/
#include <stdbool.h>
#include <stdint.h>
#include <inc/hw_memmap.h>
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* Driverlib headers */
#include <driverlib/gpio.h>
/* Board Header files */
#include <Board.h>
#include <EK_TM4C1294XL.h>
/* Application headers */
#include "Blink_Task.h"
/*
* Perform blink operation on LED given as arg0, with period defined by arg1.
*/
void BlinkFxn(UArg arg0, UArg arg1)
{
led_descriptor_t *led_desc = (led_descriptor_t *)arg0;
uint32_t wait_ticks = (uint32_t)arg1;
/* GPIO driverlib API uses same bit pattern for GPIO mask and value. */
uint8_t ui8val = (uint8_t)led_desc->led;
while(1) {
ui8val ^= (uint8_t)led_desc->led; // initially off
GPIOPinWrite (led_desc->port_base, led_desc->led, ui8val);
Task_sleep(wait_ticks);
}
}
/*
* Setup task function
*/
int setup_Blink_Task(led_descriptor_t *led_desc, uint32_t wait_ticks)
{
Task_Params taskLedParams;
Task_Handle taskLed;
Error_Block eb;
/* Configure GPIO port_base according to LED descriptor */
GPIOPinTypeGPIOOutput(led_desc->port_base, led_desc->led);
/* Create blink task with priority 15*/
Error_init(&eb);
Task_Params_init(&taskLedParams);
taskLedParams.stackSize = 1024; /* stack in bytes */
taskLedParams.priority = 15; /* 0-15 (15 is highest priority on default -> see RTOS Task configuration) */
taskLedParams.arg0 = (UArg)led_desc; /* pass led descriptor as arg0 */
taskLedParams.arg1 = (UArg)wait_ticks; /* pass periods in ticks as arg1 */
taskLed = Task_create((Task_FuncPtr)BlinkFxn, &taskLedParams, &eb);
if (taskLed == NULL) {
System_abort("TaskLed create failed");
}
return (0);
}
/******************************************************************************
*
* Default Linker Command file for the Texas Instruments TM4C1294NCPDT
*
* This is derived from revision 11167 of the TivaWare Library.
*
*****************************************************************************/
--retain=g_pfnVectors
MEMORY
{
FLASH (RX) : origin = 0x00000000, length = 0x00100000
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}
/* The following command line options are set as part of the CCS project. */
/* If you are building using the command line, or for some reason want to */
/* define them here, you can uncomment and modify these lines as needed. */
/* If you are using CCS for building, it is probably better to make any such */
/* modifications in your CCS project and leave this file alone. */
/* */
/* --heap_size=0 */
/* --stack_size=256 */
/* --library=rtsv7M4_T_le_eabi.lib */
/* Section allocation in memory */
SECTIONS
{
.intvecs: > 0x00000000
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.vtable : > 0x20000000
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
}
__STACK_TOP = __stack + 512;
= Generic Basic TI-RTOS Project
You may use this project as a basis for your own needs
== Additional Activated Features
. NDK Networking stack - Deacticate in the '.cfg' file if required.
. 40kB of System Heap (Used by Tasks to allocate stack memory) - Alter in '.cfg' file if needed.
. Software Interrupts - Change in '.cfg' file if needed.
== Example Tasks
. Blink Tasks using the clock module
. UART Echo Task
== Additonal Configuration possibilites
. Define 'CAN_0' in 'local_inc/EK_TM4C1294XL.h' to make use of the CAN controller and remap the UART pins from UART 0 to UART 1.
. Define 'I2CM_7' and 'I2CM_8' as well as 'SSIM_2' and 'SSIM_3' in 'local_inc/EK_TM4C1294XL.h' according to you needs.
/*
* ======== StartBIOS.c ========
*/
#include <stdbool.h>
#include <stdint.h>
#include <inc/hw_memmap.h>
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* Currently unused RTOS headers that are needed
* for advanced features like IPC. */
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Mailbox.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/hal/Timer.h>
/* Driverlib headers */
#include <driverlib/gpio.h>
/* Board Header files */
#include <Board.h>
#include <EK_TM4C1294XL.h>
/* Application headers */
#include <Blink_Task.h>
#include <UART_Task.h>
/*
* NOTE: All local variables in main() will be discarded once BIOS_start() is called.
*/
int main(void)
{
uint32_t ui32SysClock;
static led_descriptor_t led_desc[2];
/* Call board init functions. */
ui32SysClock = Board_initGeneral(120*1000*1000);
(void)ui32SysClock; // We don't really need this (yet)
led_desc[0].port_base = GPIO_PORTN_BASE;
led_desc[0].led = GPIO_PIN_1;
/* Initialize+start Blink Task*/
(void)setup_Blink_Task(&led_desc[0], 500);
/* System_printf() is VERY slow!*/
System_printf("Created Blink Task1\n");
System_flush();
led_desc[1].port_base = GPIO_PORTF_BASE;
led_desc[1].led = GPIO_PIN_0;
/*Initialize+start Blink Task*/
(void)setup_Blink_Task(&led_desc[1], 250/*ticks to wait*/);
System_printf("Created Blink Task2\n");
System_flush();
/*Initialize+start UART Task*/
(void)setup_UART_Task();
System_printf("Created UART Task\n");
System_flush();
/* SysMin will only print to the console upon calling flush or exit */
System_printf("Start BIOS\n");
System_flush();
/* Start BIOS */
BIOS_start();
}
This diff is collapsed.
/*
* ======== UART_Task.c ========
* Author: Michael Kramer / Matthias Wenzl
*/
#include <stdbool.h>
#include <stdint.h>
#include <inc/hw_memmap.h>
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* TI-RTOS Header files */
#include <driverlib/sysctl.h>
#include <ti/drivers/UART.h>
/* Driverlib headers */
#include <driverlib/gpio.h>
#include <driverlib/pin_map.h>
/*Board Header files */
#include <Board.h>
#include <EK_TM4C1294XL.h>
/* Application headers */
#include "UART_Task.h"
/*
* ======== UART ========
* Echo Characters recieved and show reception on Port N Led 0
*/
void UARTFxn(UArg arg0, UArg arg1)
{
UART_Handle uart;
UART_Params uartParams;
const char echoPrompt[] = "\fEchoing characters:\r\n";
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 9600;
#ifdef CAN_0
uart = UART_open(Board_UART1, &uartParams);
#else
uart = UART_open(Board_UART0, &uartParams);
#endif
if (uart == NULL) {
System_abort("Error opening the UART");
}
UART_write(uart, echoPrompt, sizeof(echoPrompt));
/* Loop forever echoing */
while (1) {
char input;
UART_read(uart, &input, 1);
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 1);
UART_write(uart, &input, 1); // Remove this line to stop echoing!
Task_sleep(5);
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0);
}
}
/*
* Setup task function
*/
int setup_UART_Task(void)
{
Task_Params taskUARTParams;
Task_Handle taskUART;
Error_Block eb;
/* Enable and configure the peripherals used by the UART0 */
#ifdef CAN_0
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
GPIOPinConfigure(GPIO_PD4_U2RX);
GPIOPinConfigure(GPIO_PD5_U2TX);
GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
#else
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
#endif
UART_init();
/* Setup PortN LED1 activity signaling */
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
Error_init(&eb);
Task_Params_init(&taskUARTParams);
taskUARTParams.stackSize = 1024; /* stack in bytes */
taskUARTParams.priority = 15; /* 0-15 (15 is highest priority on default -> see RTOS Task configuration) */
taskUART = Task_create((Task_FuncPtr)UARTFxn, &taskUARTParams, &eb);
if (taskUART == NULL) {
System_abort("TaskUART create failed");
}
return (0);
}
/*! \file Blink_Task.h
\brief Blink task
\author Matthias Wenzl
\author Michael Kramer
Blinking LED Task example.
*/
#ifndef BLINK_TASK_H_
#define BLINK_TASK_H_
#include <stdbool.h>
#include <stdint.h>
#include <xdc/std.h>
typedef struct {
uint32_t port_base;
uint8_t led;
} led_descriptor_t;
/*! \fn BlinkFxn
* \brief Execute Blink Task
*
* \param arg0 led descriptor struct
* \param arg1 Ticks to wait
*/
void BlinkFxn(UArg arg0, UArg arg1);
/*! \fn setup_Blink_Task
* \brief Setup Blink task
*
* Setup Blink task
* Task has highest priority and receives 1kB of stack
*
* \param led_desc LED descriptor.
* \param time to wait in ticks for led to toggle
*
* \return always zero. In case of error the system halts.
*/
int setup_Blink_Task(led_descriptor_t *led_desc, uint32_t wait_ticks);
#endif
/*
* Copyright (c) 2014, 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.
*/
#ifndef __BOARD_H
#define __BOARD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "EK_TM4C1294XL.h"
#define Board_initEMAC EK_TM4C1294XL_initEMAC
#define Board_initGeneral EK_TM4C1294XL_initGeneral
#define Board_initGPIO EK_TM4C1294XL_initGPIO
#define Board_initCAN EK_TM4C1294XL_initCAN
#define Board_initI2C EK_TM4C1294XL_initI2C
#define Board_initSDSPI EK_TM4C1294XL_initSDSPI
#define Board_initSPI EK_TM4C1294XL_initSPI
#define Board_initUART EK_TM4C1294XL_initUART
#define Board_initUSB EK_TM4C1294XL_initUSB
#define Board_initUSBMSCHFatFs EK_TM4C1294XL_initUSBMSCHFatFs
#define Board_initWatchdog EK_TM4C1294XL_initWatchdog
#define Board_initWiFi EK_TM4C1294XL_initWiFi
#define Board_LED_ON EK_TM4C1294XL_LED_ON
#define Board_LED_OFF EK_TM4C1294XL_LED_OFF
#define Board_LED0 EK_TM4C1294XL_D1
#define Board_LED1 EK_TM4C1294XL_D2
#define Board_LED2 EK_TM4C1294XL_D2
#define Board_BUTTON0 EK_TM4C1294XL_USR_SW1
#define Board_BUTTON1 EK_TM4C1294XL_USR_SW2
#define Board_I2C0 EK_TM4C1294XL_I2C7
#define Board_I2C1 EK_TM4C1294XL_I2C8
#define Board_I2C2 EK_TM4C1294XL_I2C0
#define Board_I2C3 EK_TM4C1294XL_I2C2
#define Board_I2C_TMP EK_TM4C1294XL_I2C7
#define Board_I2C_NFC EK_TM4C1294XL_I2C7
#define Board_I2C_TPL0401 EK_TM4C1294XL_I2C7
#define Board_SDSPI0 EK_TM4C1294XL_SDSPI0
#define Board_SDSPI1 EK_TM4C1294XL_SDSPI1
#define Board_SPI0 EK_TM4C1294XL_SPI2
#define Board_SPI1 EK_TM4C1294XL_SPI3
#define Board_SPI_CC3100 EK_TM4C1294XL_SPI2
#define Board_USBMSCHFatFs0 EK_TM4C1294XL_USBMSCHFatFs0
#define Board_USBHOST EK_TM4C1294XL_USBHOST
#define Board_USBDEVICE EK_TM4C1294XL_USBDEVICE
#define Board_UART0 EK_TM4C1294XL_UART0
#define Board_UART1 EK_TM4C1294XL_UART2
#define Board_UART2 EK_TM4C1294XL_UART6
#define Board_UART3 EK_TM4C1294XL_UART7
#define Board_WATCHDOG0 EK_TM4C1294XL_WATCHDOG0
#define Board_WIFI EK_TM4C1294XL_WIFI
#define Board_gpioCallbacks0 EK_TM4C1294XL_gpioPortJCallbacks
#define Board_gpioCallbacks1 EK_TM4C1294XL_gpioPortJCallbacks
/* Board specific I2C addresses */
#define Board_TMP006_ADDR (0x40)
#define Board_RF430CL330_ADDR (0x28)
#define Board_TPL0401_ADDR (0x40)
#ifdef __cplusplus
}
#endif
#endif /* __BOARD_H */
/*
* Copyright (c) 2015, 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.
*/
/** ============================================================================
* @file EK_TM4C1294XL.h
*
* @brief EK_TM4C1294XL Board Specific APIs
*
* The EK_TM4C1294XL header file should be included in an application as
* follows:
* @code
* #include <EK_TM4C1294XL.h>
* @endcode
*
* ============================================================================
*/
#ifndef __EK_TM4C1294XL_H
#define __EK_TM4C1294XL_H
#ifdef __cplusplus
extern "C" {
#endif
//#define CAN_0 1
#if CAN_0
#warning "Device CAN_0 is in use, use UART 1 instead of UART 0"
#endif
/* The defines below control the respective hardware masters.
* To enable or disable them set the respective macro to 1 or 0 respectively. */
/*i2c configuration*/
//#define I2CM_7 1
#define I2CM_8 1
/*spi configguration*/
#define SSIM_2 1
//#define SSIM_3 1
#if (I2CM_7 && SSIM_2)
#error "I2M_7 and SSIM_2 use the same physical pins -> conflict - Please configure to your needs (local_inc/EK_TM4C1294XL.h)"
#endif
#if (I2CM_8 && SSIM_3)
#error "I2M_8 and SSIM_3 use the same physical pins -> conflict - Please configure to your needs (local_inc/EK_TM4C1294XL.h)"
#endif
/* LEDs on EK_TM4C1294XL are active high. */
#define EK_TM4C1294XL_LED_OFF (0)
#define EK_TM4C1294XL_LED_ON (1)
/*!
* @def EK_TM4C1294XL_EMACName
* @brief Enum of EMAC names on the EK_TM4C1294XL dev board
*/
typedef enum EK_TM4C1294XL_EMACName {
EK_TM4C1294XL_EMAC0 = 0,