[target][lm3s6965evb] add support for stellaris based lm3s6965evb board

This seems to be somewhat properly emulated in qemu.

qemu-system-arm -machine lm3s6965evb -cpu cortex-m3
This commit is contained in:
Travis Geiselbrecht
2016-02-20 19:52:35 -08:00
parent ee07e694aa
commit e604f4b103
12 changed files with 106 additions and 19 deletions

View File

@@ -79,10 +79,12 @@ void stellaris_debug_early_init(void)
STATIC_ASSERT(DEBUG_UART == UART0_BASE);
if (DEBUG_UART == UART0_BASE) {
#if defined(PART_LM4F120H5QR)
/* Set GPIO A0 and A1 as UART pins. */
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_AHB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
#endif
}
UARTConfigSetExpClk(DEBUG_UART, SysCtlClockGet(), 115200, UART_CONFIG_WLEN_8|UART_CONFIG_STOP_ONE|UART_CONFIG_PAR_NONE);

View File

@@ -53,7 +53,17 @@ void platform_early_init(void)
//
// Set the clocking to run directly from the crystal.
//
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
ulong config = SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN;
#if !defined(CRYSTAL_FREQ) || CRYSTAL_FREQ == 16000000
config |= SYSCTL_XTAL_16MHZ;
#elif CRYSTAL_FREQ == 8000000
config |= SYSCTL_XTAL_8MHZ;
#else
#error add more cases for additional frequencies
#endif
SysCtlClockSet(config);
// start the generic systick timer
arm_cm_systick_init(SysCtlClockGet());

View File

@@ -11,9 +11,15 @@ MEMSIZE ?= 32768
MEMBASE := 0x20000000
ROMBASE := 0x00000000
ARM_CPU := cortex-m3
# should this be here?
GLOBAL_DEFINES += TARGET_IS_BLIZZARD_RA1
endif
ifeq ($(STELLARIS_CHIP),LM3S6965)
MEMSIZE ?= 65536
MEMBASE := 0x20000000
ROMBASE := 0x00000000
ARM_CPU := cortex-m3
GLOBAL_DEFINES += TARGET_IS_FURY_RA2
endif
GLOBAL_DEFINES += PART_$(STELLARIS_CHIP)
@@ -28,17 +34,6 @@ MODULE_SRCS += \
$(LOCAL_DIR)/usbc.c \
$(LOCAL_DIR)/vectab.c \
# $(LOCAL_DIR)/debug.c \
$(LOCAL_DIR)/interrupts.c \
$(LOCAL_DIR)/platform_early.c \
$(LOCAL_DIR)/platform.c \
$(LOCAL_DIR)/timer.c \
$(LOCAL_DIR)/init_clock.c \
$(LOCAL_DIR)/init_clock_48mhz.c \
$(LOCAL_DIR)/mux.c \
$(LOCAL_DIR)/emac_dev.c
# use a two segment memory layout, where all of the read-only sections
# of the binary reside in rom, and the read/write are in memory. The
# ROMBASE, MEMBASE, and MEMSIZE make variables are required to be set

View File

@@ -0,0 +1,4 @@
MODULES += \
include project/virtual/test.mk
include project/target/lm3s6965evb.mk

View File

@@ -1,6 +1,4 @@
MODULES += \
app/shell \
app/tests \
lib/debugcommands
include project/stellaris-launchpad.mk
include project/virtual/test.mk
include project/target/stellaris-launchpad.mk

View File

@@ -0,0 +1 @@
TARGET := lm3s6965evb

View File

@@ -8,6 +8,7 @@ function HELP {
echo "-n a virtio network device"
echo "-t a virtio tap network device"
echo "-d a virtio display"
echo "-3 cortex-m3 based platform"
echo "-6 64bit arm"
echo "-m <memory in MB>"
echo "-s <number of cpus>"
@@ -20,6 +21,7 @@ DO_NET=0
DO_NET_TAP=0
DO_BLOCK=0
DO_64BIT=0
DO_CORTEX_M3=0
DO_DISPLAY=0
DO_CMPCTMALLOC=0
DO_MINIHEAP=0
@@ -27,7 +29,7 @@ SMP=1
MEMSIZE=512
SUDO=""
while getopts bdhm:cMnt6s: FLAG; do
while getopts bdhm:cMnt36s: FLAG; do
case $FLAG in
b) DO_BLOCK=1;;
c) DO_CMPCTMALLOC=1;;
@@ -35,6 +37,7 @@ while getopts bdhm:cMnt6s: FLAG; do
M) DO_MINIHEAP=1;;
n) DO_NET=1;;
t) DO_NET_TAP=1;;
3) DO_CORTEX_M3=1;;
6) DO_64BIT=1;;
m) MEMSIZE=$OPTARG;;
s) SMP=$OPTARG;;
@@ -50,6 +53,9 @@ shift $((OPTIND-1))
if [ $DO_64BIT == 1 ]; then
QEMU="qemu-system-aarch64 -machine virt -cpu cortex-a53"
PROJECT="qemu-virt-a53-test"
elif [ $DO_CORTEX_M3 == 1 ]; then
QEMU="qemu-system-arm -machine lm3s6965evb -cpu cortex-m3"
PROJECT="lm3s6965evb-test"
else
QEMU="qemu-system-arm -machine virt -cpu cortex-a15"
PROJECT="qemu-virt-a15-test"

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2012 Travis Geiselbrecht
*
* 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.
*
* 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.
*/
#ifndef __TARGET_DEBUGCONFIG_H
#define __TARGET_DEBUGCONFIG_H
#endif

30
target/lm3s6965evb/init.c Normal file
View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) 2016 Travis Geiselbrecht
*
* 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.
*
* 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.
*/
#include <err.h>
#include <debug.h>
#include <target.h>
#include <compiler.h>
#include <dev/gpio.h>
#include <platform/gpio.h>
#include "ti_driverlib.h"

View File

@@ -0,0 +1,14 @@
LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
STELLARIS_CHIP := LM3S6965
PLATFORM := stellaris
GLOBAL_DEFINES += \
CRYSTAL_FREQ=8000000
MODULE_SRCS += \
$(LOCAL_DIR)/init.c
include make/module.mk

View File

@@ -6,7 +6,8 @@ STELLARIS_CHIP := LM4F120H5QR
PLATFORM := stellaris
GLOBAL_DEFINES += \
TARGET_HAS_DEBUG_LED=1
TARGET_HAS_DEBUG_LED=1 \
CRYSTAL_FREQ=16000000
MODULE_SRCS += \
$(LOCAL_DIR)/init.c \