Fix tiva demos

This commit is contained in:
Fabio Utzig 2016-04-04 21:35:11 -03:00
parent 031d81ae18
commit 653c72ccc3
11 changed files with 96 additions and 29 deletions

View File

@ -83,7 +83,7 @@ PROJECT = ch
CHIBIOS = ../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_tm4c123x.mk
include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c123x.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/TM4C123x/platform.mk
@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/TI_TM4C123G_LAUNCHPAD/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@ -207,5 +207,5 @@ ULIBS =
# End of user defines
##############################################################################
RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk

View File

@ -1,6 +1,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
#define _CHIBIOS_RT_CONF_
/*===========================================================================*/
/**
* @name System timers settings
@ -413,6 +415,20 @@
/* System halt code here.*/ \
}
/**
* @brief ISR enter hook.
*/
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
/* IRQ prologue code here.*/ \
}
/**
* @brief ISR exit hook.
*/
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
/* IRQ epilogue code here.*/ \
}
/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
@ -457,6 +473,15 @@
/* System halt code here.*/ \
}
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
#define CH_CFG_TRACE_HOOK(tep) { \
/* Trace code here.*/ \
}
/** @} */
/*===========================================================================*/

View File

@ -16,7 +16,7 @@
#include "ch.h"
#include "hal.h"
#include "test.h"
#include "ch_test.h"
typedef struct led_config
{
@ -31,8 +31,7 @@ typedef struct led_config
static THD_WORKING_AREA(waBlinkLedRed, 128);
static THD_WORKING_AREA(waBlinkLedGreen, 128);
static THD_WORKING_AREA(waBlinkLedBlue, 128);
static msg_t blinkLed(void *arg)
{
static THD_FUNCTION(blinkLed, arg) {
led_config_t *ledConfig = (led_config_t*) arg;
chRegSetThreadName("Blinker");
@ -43,8 +42,6 @@ static msg_t blinkLed(void *arg)
chThdSleepMilliseconds(ledConfig->sleep);
palTogglePad(ledConfig->port, ledConfig->pin);
}
return (msg_t) 0;
}
/*
@ -72,7 +69,7 @@ int main(void)
sdStart(&SD1, NULL);
if (!palReadPad(GPIOF, GPIOF_SW2)) {
TestThread(&SD1);
test_execute((BaseSequentialStream *)&SD1);
}
ledRed.port = GPIOF;
@ -101,6 +98,6 @@ int main(void)
while (TRUE) {
chThdSleepMilliseconds(100);
}
return 0;
}

View File

@ -83,7 +83,7 @@ PROJECT = ch
CHIBIOS = ../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk
include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/TM4C129x/platform.mk
@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/TI_TM4C1294_LAUNCHPAD/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk
@ -210,5 +210,5 @@ ULIBS =
# End of user defines
##############################################################################
RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk

View File

@ -1,6 +1,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
#define _CHIBIOS_RT_CONF_
/*===========================================================================*/
/**
* @name System timers settings
@ -413,6 +415,20 @@
/* System halt code here.*/ \
}
/**
* @brief ISR enter hook.
*/
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
/* IRQ prologue code here.*/ \
}
/**
* @brief ISR exit hook.
*/
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
/* IRQ epilogue code here.*/ \
}
/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
@ -457,6 +473,15 @@
/* System halt code here.*/ \
}
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
#define CH_CFG_TRACE_HOOK(tep) { \
/* Trace code here.*/ \
}
/** @} */
/*===========================================================================*/

View File

@ -87,7 +87,7 @@ THD_WORKING_AREA(wa_http_server, WEB_THREAD_STACK_SIZE);
/**
* HTTP server thread.
*/
msg_t http_server(void *p) {
THD_FUNCTION(http_server, p) {
struct netconn *conn, *newconn;
err_t err;
@ -95,7 +95,7 @@ msg_t http_server(void *p) {
/* Create a new TCP connection handle */
conn = netconn_new(NETCONN_TCP);
LWIP_ERROR("http_server: invalid conn", (conn != NULL), return MSG_RESET;);
LWIP_ERROR("http_server: invalid conn", (conn != NULL), return;);
/* Bind to port 80 (HTTP) with default IP address */
netconn_bind(conn, NULL, WEB_THREAD_PORT);
@ -113,7 +113,6 @@ msg_t http_server(void *p) {
http_server_serve(newconn);
netconn_delete(newconn);
}
return MSG_OK;
}
#endif /* LWIP_NETCONN */

View File

@ -41,7 +41,7 @@ extern THD_WORKING_AREA(wa_http_server, WEB_THREAD_STACK_SIZE);
#ifdef __cplusplus
extern "C" {
#endif
msg_t http_server(void *p);
void http_server(void *p);
#ifdef __cplusplus
}
#endif

View File

@ -83,7 +83,7 @@ PROJECT = ch
CHIBIOS = ../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk
include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/TM4C129x/platform.mk
@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/TI_TM4C1294_LAUNCHPAD/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@ -151,7 +151,6 @@ INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
MCU = cortex-m4
#TRGT = arm-elf-
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
@ -207,5 +206,5 @@ ULIBS =
# End of user defines
##############################################################################
RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk

View File

@ -1,6 +1,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
#define _CHIBIOS_RT_CONF_
/*===========================================================================*/
/**
* @name System timers settings
@ -413,6 +415,20 @@
/* System halt code here.*/ \
}
/**
* @brief ISR enter hook.
*/
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
/* IRQ prologue code here.*/ \
}
/**
* @brief ISR exit hook.
*/
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
/* IRQ epilogue code here.*/ \
}
/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
@ -457,6 +473,15 @@
/* System halt code here.*/ \
}
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
#define CH_CFG_TRACE_HOOK(tep) { \
/* Trace code here.*/ \
}
/** @} */
/*===========================================================================*/

View File

@ -16,7 +16,7 @@
#include "ch.h"
#include "hal.h"
#include "test.h"
#include "ch_test.h"
typedef struct led_config
{
@ -32,8 +32,7 @@ static THD_WORKING_AREA(waBlinkLed1, 128);
static THD_WORKING_AREA(waBlinkLed2, 128);
static THD_WORKING_AREA(waBlinkLed3, 128);
static THD_WORKING_AREA(waBlinkLed4, 128);
static msg_t blinkLed(void *arg)
{
static THD_FUNCTION(blinkLed, arg) {
led_config_t *ledConfig = (led_config_t*) arg;
chRegSetThreadName("Blinker");
@ -45,8 +44,6 @@ static msg_t blinkLed(void *arg)
chThdSleepMilliseconds(ledConfig->sleep);
palTogglePad(ledConfig->port, ledConfig->pin);
}
return (msg_t) 0;
}
/*
@ -74,7 +71,7 @@ int main(void)
sdStart(&SD1, NULL);
if (!palReadPad(GPIOJ, GPIOJ_SW1)) {
TestThread(&SD1);
test_execute((BaseSequentialStream *)&SD1);
}
led1.port = GPIOF;
@ -112,6 +109,6 @@ int main(void)
while (TRUE) {
chThdSleepMilliseconds(100);
}
return 0;
}

View File

@ -28,7 +28,7 @@
#if HAL_USE_MAC || defined(__DOXYGEN__)
#include "mii.h"
#include "hal_mii.h"
/*===========================================================================*/
/* Driver local definitions. */