summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c1a7f2)
raw | patch | inline | side by side (parent: 3c1a7f2)
author | Jonah Willis <j-willis@ti.com> | |
Wed, 24 Apr 2019 20:09:49 +0000 (15:09 -0500) | ||
committer | Jonah Willis <j-willis@ti.com> | |
Mon, 13 May 2019 19:09:25 +0000 (14:09 -0500) |
PRSDK-5111
Signed-off-by: Jonah Willis <j-willis@ti.com>
Signed-off-by: Jonah Willis <j-willis@ti.com>
am437x/evmAM437x/A9/template_app/baremetal/am43xx_ddr.lds | [new file with mode: 0644] | patch | blob |
am437x/evmAM437x/A9/template_app/baremetal/app.c | [new file with mode: 0644] | patch | blob |
am437x/evmAM437x/A9/template_app/baremetal/app.h | [new file with mode: 0644] | patch | blob |
am437x/evmAM437x/A9/template_app/baremetal/baremetal_template_app_am437x_a9_evmAM437X.projectspec | [new file with mode: 0644] | patch | blob |
am437x/evmAM437x/A9/template_app/baremetal/main.c | [new file with mode: 0644] | patch | blob |
diff --git a/am437x/evmAM437x/A9/template_app/baremetal/am43xx_ddr.lds b/am437x/evmAM437x/A9/template_app/baremetal/am43xx_ddr.lds
--- /dev/null
@@ -0,0 +1,126 @@
+/**
+ * \file am335x.h
+ *
+ * \brief This file is the linker script for am335x required for building
+ * applications with the gcc toolchain.
+ *
+ * \copyright Copyright (C) 2013 Texas Instruments Incorporated -
+ * http://www.ti.com/
+ */
+
+/**
+ * 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.
+ *
+ */
+
+/*
+** The stack is kept at end of the image, and its size is 128 MB.
+** The heap section is placed above the stack to support I/O
+** operations using semi-hosting. The size of the section is 2KB.
+*/
+
+MEMORY
+{
+ DDR0 : o = 0x80000000, l = 0x10000000 /* 256MB external DDR Bank 0 */
+ OCMCRAM : o = 0x40300000, l = 0x3FC00 /* 256KB of internal RAM */
+ VECS : o = 0x4033FC00, l = 0x400 /* Vector area */
+}
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+
+SECTIONS
+{
+ .startcode :
+ {
+ . = ALIGN(4);
+ *init.o (.text)
+ } >DDR0
+
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text*)
+ *(.rodata*)
+ } >DDR0
+
+ .data :
+ {
+ . = ALIGN(4);
+ *(.data*)
+ } >DDR0
+
+ iram_start = (ADDR (.data) + SIZEOF (.data));
+ .reloc_iram :
+ AT (iram_start)
+ {
+ . = ALIGN(4);
+ relocstart = . ;
+ *("IRAM_CODE")
+ *("IRAM_DATA")
+ relocend = . ;
+ . = ALIGN(4);
+ } >OCMCRAM
+
+ .bss :
+ {
+ . = ALIGN(4);
+ _bss_start = .;
+ *(.bss*)
+ *(COMMON)
+ _bss_end = .;
+ } >DDR0
+
+ .heap :
+ {
+ . = ALIGN(4);
+ __end__ = .;
+ end = __end__;
+ __HeapBase = __end__;
+ *(.heap*)
+ . = . + 0x800;
+ __HeapLimit = .;
+ } >DDR0
+
+ .stack :
+ {
+ . = ALIGN(8);
+ __StackLimit = . ;
+ *(.stack*)
+ . = . + 0x10000;
+ __StackTop = .;
+ } >DDR0
+ _stack = __StackTop;
+
+ .exidx : {
+ __exidx_start = .;
+ *(.exidx*)
+ __exidx_end = .;
+ } >DDR0
+}
diff --git a/am437x/evmAM437x/A9/template_app/baremetal/app.c b/am437x/evmAM437x/A9/template_app/baremetal/app.c
--- /dev/null
@@ -0,0 +1,366 @@
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * 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.
+ *
+ */
+/**
+ *
+ * \brief Template application tasks file:
+ * This template application exercises multiple peripherals.
+ * The different task functions are run as part of the
+ * appRunTasksFunction().
+ * More tasks can be added in this function as required.
+ */
+
+/* Standard header files */
+#include <string.h>
+
+/* Local template app header file */
+#include "app.h"
+
+/**********************************************************************
+ ************************** Macros ************************************
+ **********************************************************************/
+#define CM_PER_TIMER3_CLKCTRL (0x44DF8800 + 0x538) // PRCM_CM_PER_TIMER3_CLKCTRL
+#define CM_DPLL_CLKSEL_TIMER3_CLK (0x44DF4200 + 0x8)
+
+#define DMTIMER3 3
+#define TIMER_ID DMTIMER3
+
+/**********************************************************************
+ ************************** Global Variables **************************
+ **********************************************************************/
+volatile uint32_t g_endTestTriggered = 0;
+volatile unsigned int delayTimerFlag;
+TimerP_Handle delayTimerHandle;
+
+/**********************************************************************
+ ************************** Function prototypes ***********************
+ **********************************************************************/
+/*
+ * Task functions:
+ * Note that these functions are called "tasks" for naming consistency
+ * with the RTOS template application, but they are not actual SYS/BIOS
+ * tasks.
+ */
+void uart_task();
+void spi_test_task();
+void i2c_eeprom_read_and_display_task();
+void gpio_toggle_led_task();
+
+/**
+ * @brief Function appRunTasks : Runs various application tasks.
+ *
+ * @retval none
+ */
+void appRunTasks()
+{
+ i2c_eeprom_read_and_display_task();
+ spi_test_task();
+ while(!g_endTestTriggered)
+ {
+ gpio_toggle_led_task();
+ uart_task();
+ }
+}
+
+/**
+ * @brief Function delayTmrIsr : ISR triggered by timer for GPIO task
+ *
+ * @retval none
+ */
+void delayTmrIsr(void* arg)
+{
+ delayTimerFlag = 1;
+}
+
+/**
+ * @brief Function osalTimerStart : Starts the timer for GPIO task
+ *
+ * @retval none
+ */
+void osalTimerStart(unsigned int ms)
+{
+ delayTimerFlag = 0;
+
+ TimerP_setPeriodMicroSecs(delayTimerHandle,
+ (uint32_t)(ms*1000));
+
+ TimerP_start(delayTimerHandle);
+}
+
+/**
+ * @brief Function osalTimerDelay : blocking delay function.
+ * The application will get stuck here if the timer is
+ * failing to trigger its ISR.
+ *
+ * @retval none
+ */
+void osalTimerDelay(unsigned int ms)
+{
+ osalTimerStart(ms);
+ while (delayTimerFlag == 0);
+}
+
+/**
+ * @brief Function gpio_toggle_led_task : Toggles LED through GPIO
+ * once per second.
+ *
+ * @retval none
+ */
+void gpio_toggle_led_task()
+{
+ static int gpio_is_init = 0;
+ static int pinval = GPIO_PIN_VAL_LOW;
+
+ /* If this is the first time calling this task, then run through the
+ * initialization procedure.
+ */
+ if (!gpio_is_init)
+ {
+ TimerP_Params delayTimerParams;
+
+ // clock source to CLK_M_OSC: 0x1 - high frequency input clock
+ // CLK_32KHz: 0x2
+ // TCLKIN : 0x0 - external clock pin - not used.
+ *(unsigned int*)CM_DPLL_CLKSEL_TIMER3_CLK = 0x1;
+
+ // enable the TIMER
+ *(unsigned int*)CM_PER_TIMER3_CLKCTRL = 0x2;
+
+ /* Create a continuous timer */
+ TimerP_Params_init(&delayTimerParams);
+ delayTimerParams.period = 1000000; // 1s
+ delayTimerParams.periodType = TimerP_PeriodType_MICROSECS;
+ delayTimerParams.arg = 0;
+ delayTimerParams.startMode = TimerP_StartMode_USER;
+ delayTimerParams.runMode = TimerP_RunMode_CONTINUOUS;
+ delayTimerHandle = TimerP_create(TIMER_ID,
+ (TimerP_Fxn)&delayTmrIsr,
+ &delayTimerParams);
+ if (delayTimerHandle == NULL) {
+ appPrint("Timer create failed\n");
+ }
+
+ /* Start the timer */
+ osalTimerDelay(1000);
+
+ gpio_is_init = 1;
+ }
+
+ /* Toggle the LED whenever flag is raised */
+ if (delayTimerFlag != 0)
+ {
+ if (pinval == GPIO_PIN_VAL_LOW)
+ {
+ GPIO_write(USER_LED1, GPIO_PIN_VAL_HIGH);
+ pinval = GPIO_PIN_VAL_HIGH;
+ }
+ else
+ {
+ GPIO_write(USER_LED1, GPIO_PIN_VAL_LOW);
+ pinval = GPIO_PIN_VAL_LOW;
+ }
+ delayTimerFlag = 0;
+ }
+}
+
+/**
+ * @brief Function uart_task : This task scans UART port and prints
+ * back the word entered. On "ESC" it triggers the end of test.
+ * Exercises reads and writes to UART port.
+ *
+ * @retval none
+ */
+void uart_task()
+{
+ static int uart_is_init = 0;
+ static char buffPointer[1000];
+ static const char echoPrompt[] = "\n uart_task :Enter a word or Esc to quit >";
+ static const char echoPrompt1[] = "Data received is:";
+ static char character;
+ static int index;
+
+ /* If this is the first time calling this task, then run through the
+ * initialization procedure.
+ */
+ if (!uart_is_init)
+ {
+ /* Get default UART params */
+ UART_Params uartParams;
+ UART_Params_init(&uartParams);
+
+ /* Set a read timeout so that UART read does not block other tasks */
+ uartParams.readTimeout = 500U;
+
+ /* De-init default UART instance and re-open with new params */
+ UART_stdioDeInit();
+ UART_stdioInit2(UART_INSTANCE, &uartParams);
+
+ uart_is_init = 1;
+
+ memset(buffPointer, 0, sizeof(buffPointer));
+
+ appPrint("\n uart_task task started\n");
+
+ /* Print prompt to UART port */
+ UART_printf(echoPrompt);
+ }
+
+ /* Get one letter at a time so other tasks are not blocked waiting
+ * for an entire string to be entered.
+ */
+ character = UART_getc();
+ if (!character)
+ {
+ //Timeout. Do nothing.
+ return;
+ }
+ else
+ {
+ /* Store each character in the buffer. When a newline is entered, print
+ * the contents of the buffer and then clear it.
+ */
+ buffPointer[index] = character;
+ /* Check on word entered here */
+ /* If needed a command parser can be added here */
+ switch(character) {
+ case '\0': /*Ignore empty string */
+ break;
+ case 27: /* Exit on ESC character */
+ goto UART_TASK_EXIT;
+ case '\n': /* Print back entire line */
+ UART_putc(character);
+ /* Display prompt */
+ UART_printf(echoPrompt1);
+ /* Display received word */
+ UART_printf(buffPointer);
+ /* Print new line */
+ UART_printf("\n");
+ index = 0;
+ memset(buffPointer, 0, sizeof(buffPointer));
+ UART_printf(echoPrompt);
+ break;
+ default:
+ /* Echo back current character */
+ UART_putc(character);
+ index++;
+ break;
+ }
+ return;
+ }
+
+UART_TASK_EXIT:
+ appPrint("\n uart_task task ended");
+ /* Trigger end test to other tasks */
+ g_endTestTriggered = 1;
+ return;
+}
+
+/**
+ * @brief Function spi_test_task : Execute read on SPI bus
+ *
+ * @retval none
+ */
+void spi_test_task()
+{
+ SPI_Params spiParams; /* SPI params structure */
+
+ appPrint("\n spi_test task started");
+ /* Default SPI configuration parameters */
+ SPI_Params_init(&spiParams);
+
+ /* TODO: Add SPI functionality test here */
+ appPrint("\n spi_test task ended");
+}
+
+/**
+ * @brief Function i2c_eeprom_read_and_display_task :
+ * Reads eeprom contents through I2C and prints Board version
+ *
+ * @retval none
+ */
+void i2c_eeprom_read_and_display_task()
+{
+ I2C_Params i2cParams;
+ I2C_Handle handle = NULL;
+ I2C_Transaction i2cTransaction;
+ bool status;
+ char txBuf[2] = {0x00, 0x00};
+ char boardName[20];
+ char boardVersion[20];
+
+ appPrint("\n i2c_eeprom_read_and_display task started");
+
+ /* Initialize parameters */
+ I2C_Params_init(&i2cParams);
+
+ /* Open I2C instance */
+ handle = I2C_open(BOARD_I2C_EEPROM_INSTANCE, &i2cParams);
+
+ /* Configure common parameters with I2C transaction */
+ i2cTransaction.slaveAddress = BOARD_I2C_EEPROM_ADDR;
+ i2cTransaction.writeBuf = (uint8_t *)&txBuf[0];
+ i2cTransaction.writeCount = 2;
+
+ /* Get board name */
+ txBuf[0] = (char)(((uint32_t) 0xFF00 & BOARD_EEPROM_BOARD_NAME_ADDR)>>8);
+ txBuf[1] = (char)((uint32_t) 0xFF & BOARD_EEPROM_BOARD_NAME_ADDR);
+ i2cTransaction.readBuf = boardName;
+ i2cTransaction.readCount = BOARD_EEPROM_BOARD_NAME_LENGTH;
+ status = I2C_transfer(handle, &i2cTransaction);
+ if (status == false)
+ {
+ I2C_close(handle);
+ appPrint("\n ERROR: I2C_transfer failed");
+ goto I2C_TEST_EXIT;
+ }
+ boardName[BOARD_EEPROM_BOARD_NAME_LENGTH] = '\0';
+ appPrint("\n Board Name read: %s", boardName);
+
+ /* Get board version */
+ txBuf[0] = (char)(((uint32_t) 0xFF00 & BOARD_EEPROM_VERSION_ADDR)>>8);
+ txBuf[1] = (char)((uint32_t) 0xFF & BOARD_EEPROM_VERSION_ADDR);
+ i2cTransaction.readBuf = boardVersion;
+ i2cTransaction.readCount = BOARD_EEPROM_VERSION_LENGTH;
+ status = I2C_transfer(handle, &i2cTransaction);
+ if (status == false)
+ {
+ I2C_close(handle);
+ appPrint("\n ERROR: I2C_transfer failed");
+ goto I2C_TEST_EXIT;
+ }
+ boardVersion[BOARD_EEPROM_VERSION_LENGTH] = '\0';
+ appPrint("\n Board version read: %s", boardVersion);
+ I2C_close(handle);
+
+I2C_TEST_EXIT:
+ appPrint("\n i2c_eeprom_read_and_display task ended");
+}
diff --git a/am437x/evmAM437x/A9/template_app/baremetal/app.h b/am437x/evmAM437x/A9/template_app/baremetal/app.h
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * 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 app.h
+ *
+ * \brief Template application header file
+ */
+
+/* Standard header files */
+#include <string.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Low level driver header files */
+#include <ti/drv/gpio/GPIO.h>
+#include <ti/drv/uart/src/UART_utils_defs.h>
+#include <ti/drv/uart/UART_stdio.h>
+#include <ti/drv/uart/UART.h>
+#include <ti/drv/uart/test/src/UART_board.h>
+#include <ti/drv/i2c/I2C.h>
+#include <ti/drv/spi/MCSPI.h>
+
+/* Board header file */
+#include <ti/board/board.h>
+
+/* Local GPIO board header file */
+#include "GPIO_board.h"
+
+/* Osal header file */
+#include <ti/osal/osal.h>
+
+
+/**********************************************************************
+ ************************** Macros ************************************
+ **********************************************************************/
+/* Route all application prints to UART */
+#define appPrint UART_printf
+
+#define USER_LED0 (0U)
+#define USER_LED1 (1U)
+
+
+/**
+ * @brief Function appRunTasks : Run the application tasks
+ *
+ * @param[in] None
+ * @retval none
+ */
+void appRunTasks(void);
diff --git a/am437x/evmAM437x/A9/template_app/baremetal/baremetal_template_app_am437x_a9_evmAM437X.projectspec b/am437x/evmAM437x/A9/template_app/baremetal/baremetal_template_app_am437x_a9_evmAM437X.projectspec
--- /dev/null
+++ b/am437x/evmAM437x/A9/template_app/baremetal/baremetal_template_app_am437x_a9_evmAM437X.projectspec
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY % cgtver SYSTEM "../../../../../common/cgt_a9_ver.dtd">
+ <!ENTITY % common_components SYSTEM "../../../../../common/common_components.dtd">
+ <!ENTITY % platform_components SYSTEM "../../../../components_am437x.dtd">
+%cgtver;
+%common_components;
+%platform_components;
+]>
+<projectSpec>
+ <project
+ title="Bare metal template App am437x a9"
+ name="baremetal_template_app_am437x_a9"
+ deviceFamily="ARM"
+ device="Cortex A.AM4372"
+ ignoreDefaultDeviceSettings="true"
+ toolChain="GNU"
+ linkerCommandFile="am43xx_ddr.lds"
+ compilerBuildOptions=
+ " -mfloat-abi=hard -DSOC_AM437x -DEVM_AM437X -DevmAM437x -DAM43XX_FAMILY_BUILD -Dgcc -mfpu=neon
+ -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm
+ -I${TI_PDK_INSTALL_DIR}/packages/"
+ linkerBuildOptions=
+ " -L${TI_PDK_INSTALL_DIR}/packages/ti/board/lib/evmAM437x/a9/release/
+ -l:ti.board.aa9fg
+ -L${TI_PDK_INSTALL_DIR}/packages/ti/drv/uart/lib/am437x/a9/release/
+ -l:ti.drv.uart.aa9fg
+ -L${TI_PDK_INSTALL_DIR}/packages/ti/osal/lib/nonos/am437x/a9/release/
+ -l:ti.osal.aa9fg
+ -L${TI_PDK_INSTALL_DIR}/packages/ti/drv/i2c/lib/am437x/a9/release/
+ -l:ti.drv.i2c.aa9fg
+ -L${TI_PDK_INSTALL_DIR}/packages/ti/drv/gpio/lib/am437x/a9/release/
+ -l:ti.drv.gpio.aa9fg
+ -L${TI_PDK_INSTALL_DIR}/packages/ti/drv/spi/lib/am437x/a9/release/
+ -l:ti.drv.spi.aa9fg
+ -L${TI_PDK_INSTALL_DIR}/packages/ti/csl/lib/am437x/a9/release/
+ -l:ti.csl.aa9fg
+ -L${TI_PDK_INSTALL_DIR}/packages/ti/starterware/binary/soc/lib/am43xx-evm/a9/release/gcc
+ -llibsoc.a
+ -nostartfiles -static --gc-sections -lgcc -lc -lm -lrdimon --entry Entry
+ -L${CG_TOOL_ROOT}/arm-none-eabi/lib/hard
+ --specs=nano.specs"
+ description="This is a template application with multiple peripheral drivers."
+ cgtVersion="&cgtver;"
+ outputFormat="ELF">
+ <property name="products" value="&common_components;;&platform_components;"/>
+ <property name="target" value="gnu.targets.arm.A9F"/>
+ <property name="platform" value="ti.platforms.evmAM437X"/>
+ <property name="buildProfile" value="release"/>
+ <property name="isHybrid" value="true"/>
+ <file path="app.c" openOnCreation="false" excludeFromBuild="false" action="copy" >
+ </file>
+ <file path="app.h" openOnCreation="false" excludeFromBuild="true" action="copy" >
+ </file>
+ <file path="main.c" openOnCreation="false" excludeFromBuild="false" action="copy" >
+ </file>
+ <file path="../GPIO_evmAM437x_board.c" openOnCreation="false" excludeFromBuild="false" action="copy" >
+ </file>
+ <file path="../GPIO_board.h" openOnCreation="false" excludeFromBuild="false" action="copy" >
+ </file>
+
+ </project>
+</projectSpec>
diff --git a/am437x/evmAM437x/A9/template_app/baremetal/main.c b/am437x/evmAM437x/A9/template_app/baremetal/main.c
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * 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.
+ *
+ */
+
+/**
+ *
+ * \brief Template application main file:
+ * The main code initializes the platform and then
+ * starts running the application tasks. The initialization
+ * includes board specific configuration and initialization
+ * of the peripherals used by the application. The application
+ * specific code is defined in a separate file: app.c.
+ *
+ */
+
+/* Standard header files */
+#include <string.h>
+
+/* Board header file */
+#include <ti/board/board.h>
+
+/* Local template app header file */
+#include "app.h"
+
+/**********************************************************************
+ ************************** Function prototypes ***********************
+ **********************************************************************/
+void peripheralInit(void);
+
+/**
+ * @brief Function main : Main application function
+ * @retval : 0: success ; -1: fail
+ */
+int main(void)
+{
+ Board_initCfg boardCfg;
+ int status;
+
+ /* First step here is board specific initialization
+ * Note that the Board_init is specific to the
+ * platform. If running on a newly custom platform
+ * the Board library needs to be ported and customized
+ * for the new platform.
+ * See Details of customizing the board library in the
+ * PDK/Processor SDK User guide */
+ /* Set Board initialization flags: */
+ boardCfg =
+#ifndef SBL_BOOT
+ /* Enabling Board Pinmux, clock when using without SBL boot
+ * to act as stand alone application.
+ */
+ BOARD_INIT_MODULE_CLOCK |
+ BOARD_INIT_PINMUX_CONFIG |
+#endif
+ /* UART_STDIO initializes the default UART port on the board
+ * and supports stdio-like UART_printf which is used by appPrint
+ */
+ BOARD_INIT_UART_STDIO;
+
+ /* Initialize Board */
+ status = Board_init(boardCfg);
+ if (status != BOARD_SOK) {
+ appPrint("\n Error: Board_init failed: error %d", status);
+ }
+ appPrint("\n Board Init complete");
+
+ /* Second step is to Initialize peripherals */
+ peripheralInit();
+
+ /* Third step is to start running the application */
+ appRunTasks();
+
+ appPrint("\n Template app ended\n");
+ return (0);
+}
+
+/**
+ * @brief Function peripheralInit : Initializes peripherals needed by
+ * application
+ * @retval : None
+ */
+void peripheralInit(void) {
+ /* UART initialization: This is redundant as it is already done
+ * as part of Board_init. Included here for completeness */
+ UART_init();
+ appPrint("\n Uart Init complete");
+
+ /* I2C initialization */
+ I2C_init();
+ appPrint("\n I2C Init complete");
+
+ /* MCSPI initialization */
+ MCSPI_init();
+ appPrint("\n MCSPI Init complete");
+
+ /* GPIO initialization */
+ GPIO_init();
+ appPrint("\n Gpio Init complete");
+
+ /* Add any additional peripherals to be initialized here */
+
+ appPrint("\n ======== Peripheral Initialization complete ========\n");
+
+}