aboutsummaryrefslogtreecommitdiff
path: root/projects/cli-test
diff options
context:
space:
mode:
Diffstat (limited to 'projects/cli-test')
-rw-r--r--projects/cli-test/Makefile18
-rw-r--r--projects/cli-test/cli-test.c4
-rw-r--r--projects/cli-test/mgmt-cli.c17
-rw-r--r--projects/cli-test/mgmt-test.c3
4 files changed, 9 insertions, 33 deletions
diff --git a/projects/cli-test/Makefile b/projects/cli-test/Makefile
index 22c8133..0a0eb9e 100644
--- a/projects/cli-test/Makefile
+++ b/projects/cli-test/Makefile
@@ -13,26 +13,12 @@ OBJS = \
test-mkmif.o \
test_sdram.o
-BOARD_OBJS = \
- $(TOPLEVEL)/stm-init.o \
- $(TOPLEVEL)/stm-fmc.o \
- $(TOPLEVEL)/stm-uart.o \
- $(TOPLEVEL)/syscalls.o \
- $(TOPLEVEL)/stm-rtc.o \
- $(TOPLEVEL)/spiflash_n25q128.o \
- $(TOPLEVEL)/stm-fpgacfg.o \
- $(TOPLEVEL)/stm-keystore.o \
- $(TOPLEVEL)/stm-sdram.o \
- $(TOPLEVEL)/stm-flash.o \
- $(BOARD_DIR)/TOOLCHAIN_GCC_ARM/startup_stm32f429xx_rtos.o \
- $(BOARD_DIR)/system_stm32f4xx.o \
- $(BOARD_DIR)/stm32f4xx_hal_msp.o \
- $(BOARD_DIR)/stm32f4xx_it_rtos.o
+BOARD_OBJS += $(TOPLEVEL)/task.o
CFLAGS += -I$(LIBCLI_SRC) -I$(LIBHAL_SRC)
CFLAGS += -I$(RTOS_DIR)/rtos -I$(RTOS_DIR)/rtx/TARGET_CORTEX_M
-LIBS += $(LIBCLI_BLD)/libcli.a $(LIBHAL_BLD)/libhal.a $(LIBTFM_BLD)/libtfm.a $(RTOS_DIR)/librtos.a
+LIBS += $(LIBCLI_BLD)/libcli.a $(LIBHAL_BLD)/libhal.a $(LIBTFM_BLD)/libtfm.a
all: $(TEST:=.elf)
diff --git a/projects/cli-test/cli-test.c b/projects/cli-test/cli-test.c
index 397c304..c288257 100644
--- a/projects/cli-test/cli-test.c
+++ b/projects/cli-test/cli-test.c
@@ -50,8 +50,8 @@
/* MGMT UART interrupt receive buffer (data will be put in a larger ring buffer) */
volatile uint8_t uart_rx;
-/* Delay on bad PINs */
-void hal_sleep(const unsigned seconds) { osDelay(seconds * 1000); }
+/* Sleep for specified number of seconds -- used after bad PIN. */
+void hal_sleep(const unsigned seconds) { HAL_Delay(seconds * 1000); }
int
main()
diff --git a/projects/cli-test/mgmt-cli.c b/projects/cli-test/mgmt-cli.c
index b513ddc..eacb944 100644
--- a/projects/cli-test/mgmt-cli.c
+++ b/projects/cli-test/mgmt-cli.c
@@ -3,7 +3,7 @@
* ---------
* Management CLI code.
*
- * Copyright (c) 2016, NORDUnet A/S All rights reserved.
+ * Copyright (c) 2016-2017, NORDUnet A/S All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -36,8 +36,6 @@
/* Rename both CMSIS HAL_OK and libhal HAL_OK to disambiguate */
#define HAL_OK CMSIS_HAL_OK
-#include "cmsis_os.h"
-
#include "stm-init.h"
#include "stm-uart.h"
#include "stm-led.h"
@@ -95,18 +93,11 @@ static ringbuf_t uart_ringbuf;
/* current character received from UART */
static uint8_t uart_rx;
-/* Semaphore to inform uart_cli_read that there's a new character.
- */
-osSemaphoreId uart_sem;
-osSemaphoreDef(uart_sem);
-
/* Callback for HAL_UART_Receive_DMA().
*/
void HAL_UART1_RxCpltCallback(UART_HandleTypeDef *huart)
{
ringbuf_write_char(&uart_ringbuf, uart_rx);
- osSemaphoreRelease(uart_sem);
- HAL_UART_Receive_DMA(huart, &uart_rx, 1);
}
static void uart_cli_print(struct cli_def *cli __attribute__ ((unused)), const char *buf)
@@ -119,8 +110,8 @@ static void uart_cli_print(struct cli_def *cli __attribute__ ((unused)), const c
static ssize_t uart_cli_read(struct cli_def *cli __attribute__ ((unused)), void *buf, size_t count)
{
for (int i = 0; i < count; ++i) {
- while (ringbuf_read_char(&uart_ringbuf, (uint8_t *)(buf + i)) == 0)
- osSemaphoreWait(uart_sem, osWaitForever);
+ while (ringbuf_read_char(&uart_ringbuf, (uint8_t *)(buf + i)) == 0) {
+ }
}
return (ssize_t)count;
}
@@ -173,8 +164,6 @@ static int check_auth(const char *username, const char *password)
int cli_main(void)
{
- uart_sem = osSemaphoreCreate(osSemaphore(uart_sem), 0);
-
struct cli_def *cli;
cli = mgmt_cli_init();
cli_set_auth_callback(cli, check_auth);
diff --git a/projects/cli-test/mgmt-test.c b/projects/cli-test/mgmt-test.c
index 59f0b6e..54021a5 100644
--- a/projects/cli-test/mgmt-test.c
+++ b/projects/cli-test/mgmt-test.c
@@ -37,6 +37,7 @@
#include "stm-sdram.h"
#include "stm-fmc.h"
#include "stm-fpgacfg.h"
+#include "task.h"
#include "mgmt-cli.h"
#include "mgmt-test.h"
@@ -131,7 +132,7 @@ static int cmd_test_fmc(struct cli_def *cli, const char *command, char *argv[],
led_on(LED_BLUE);
while (! fpgacfg_check_done()) {
for (i = 0; i < 4; i++) {
- HAL_Delay(500);
+ task_delay(500);
led_toggle(LED_BLUE);
}
}