From 653c72ccc3c8ff29bb2f2cffa00d1898c96c8ecf Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Mon, 4 Apr 2016 21:35:11 -0300 Subject: Fix tiva demos --- demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile | 6 +++--- demos/TIVA/RT-TM4C123G-LAUNCHPAD/chconf.h | 25 +++++++++++++++++++++++++ demos/TIVA/RT-TM4C123G-LAUNCHPAD/main.c | 11 ++++------- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile | 6 +++--- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/chconf.h | 25 +++++++++++++++++++++++++ demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c | 5 ++--- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h | 2 +- demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile | 7 +++---- demos/TIVA/RT-TM4C1294-LAUNCHPAD/chconf.h | 25 +++++++++++++++++++++++++ demos/TIVA/RT-TM4C1294-LAUNCHPAD/main.c | 11 ++++------- 10 files changed, 95 insertions(+), 28 deletions(-) (limited to 'demos') diff --git a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile index 47560db..92a608c 100644 --- a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile +++ b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile @@ -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 diff --git a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/chconf.h b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/chconf.h index 25b16cc..5e7c63d 100644 --- a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/chconf.h +++ b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/chconf.h @@ -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.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/main.c b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/main.c index 0a64adb..29a1b20 100644 --- a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/main.c +++ b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/main.c @@ -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; } diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile index f69722b..8d96b75 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile @@ -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 diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/chconf.h b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/chconf.h index ad50207..e0be810 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/chconf.h +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/chconf.h @@ -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.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c index dfc9d0d..d3d74df 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c @@ -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 */ diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h index 2764242..11b245b 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h @@ -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 diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile index 08aace6..344d3e8 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile @@ -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 diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/chconf.h b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/chconf.h index aac875a..e99b5b3 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/chconf.h +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/chconf.h @@ -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.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/main.c b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/main.c index bb2b0e3..adb915e 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/main.c +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/main.c @@ -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; } -- cgit v1.2.3 From d7ceec1a01ad9c100bac9daf555c6eafe46e793b Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Mon, 4 Apr 2016 22:18:58 -0300 Subject: Fix test thread usage --- demos/KINETIS/RT-FREEDOM-K20D50M/main.c | 4 ++-- demos/KINETIS/RT-FREEDOM-KL25Z/main.c | 4 ++-- demos/KINETIS/RT-TEENSY3/main.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'demos') diff --git a/demos/KINETIS/RT-FREEDOM-K20D50M/main.c b/demos/KINETIS/RT-FREEDOM-K20D50M/main.c index 9a2ca0e..558e7ad 100644 --- a/demos/KINETIS/RT-FREEDOM-K20D50M/main.c +++ b/demos/KINETIS/RT-FREEDOM-K20D50M/main.c @@ -16,7 +16,7 @@ #include "ch.h" #include "hal.h" -#include "test.h" +#include "ch_test.h" static THD_WORKING_AREA(waThread1, 64); static THD_FUNCTION(Thread1, arg) { @@ -78,7 +78,7 @@ int main(void) { chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL); chThdCreateStatic(waThread3, sizeof(waThread3), NORMALPRIO, Thread3, NULL); - TestThread(&SD1); + test_execute((BaseSequentialStream *)&SD1); while (1) { chThdSleepMilliseconds(500); } diff --git a/demos/KINETIS/RT-FREEDOM-KL25Z/main.c b/demos/KINETIS/RT-FREEDOM-KL25Z/main.c index d565ca0..479356c 100644 --- a/demos/KINETIS/RT-FREEDOM-KL25Z/main.c +++ b/demos/KINETIS/RT-FREEDOM-KL25Z/main.c @@ -16,7 +16,7 @@ #include "ch.h" #include "hal.h" -#include "test.h" +#include "ch_test.h" static THD_WORKING_AREA(waThread1, 64); static THD_FUNCTION(Thread1, arg) { @@ -78,7 +78,7 @@ int main(void) { chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL); chThdCreateStatic(waThread3, sizeof(waThread3), NORMALPRIO, Thread3, NULL); - TestThread(&SD1); + test_execute((BaseSequentialStream *)&SD1); while (1) { chThdSleepMilliseconds(500); } diff --git a/demos/KINETIS/RT-TEENSY3/main.c b/demos/KINETIS/RT-TEENSY3/main.c index ebeb637..42d6510 100644 --- a/demos/KINETIS/RT-TEENSY3/main.c +++ b/demos/KINETIS/RT-TEENSY3/main.c @@ -16,7 +16,7 @@ #include "ch.h" #include "hal.h" -#include "test.h" +#include "ch_test.h" /* * LED blinker thread. @@ -57,7 +57,7 @@ int main(void) { */ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); - TestThread(&SD1); + test_execute((BaseSequentialStream *)&SD1); while (true) { chThdSleepMilliseconds(1000); } -- cgit v1.2.3 From 7c6fc955f7f2e6eff0cc948e795023802ef4fa6b Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Tue, 5 Apr 2016 18:05:02 -0300 Subject: Improve http_server declaration --- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos') diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h index 11b245b..ed0fffd 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h @@ -41,7 +41,7 @@ extern THD_WORKING_AREA(wa_http_server, WEB_THREAD_STACK_SIZE); #ifdef __cplusplus extern "C" { #endif - void http_server(void *p); + THD_FUNCTION(http_server, p); #ifdef __cplusplus } #endif -- cgit v1.2.3