diff --git a/test/embedded/Makefile b/test/embedded/Makefile new file mode 100644 index 000000000..d9e5b59f3 --- /dev/null +++ b/test/embedded/Makefile @@ -0,0 +1,48 @@ +CC = g++ + +# Requirements: cpputest.github.io + +BTSTACK_ROOT = ../.. + +CFLAGS = -g -Wall \ + -I.. \ + -I${BTSTACK_ROOT}/src \ + -I${BTSTACK_ROOT}/platform/embedded + +CFLAGS += -fprofile-arcs -ftest-coverage + +LDFLAGS += -lCppUTest -lCppUTestExt + +VPATH += ${BTSTACK_ROOT}/src +VPATH += ${BTSTACK_ROOT}/src/ble +VPATH += ${BTSTACK_ROOT}/platform/embedded + +COMMON = \ + btstack_util.c \ + btstack_linked_list.c \ + btstack_audio_embedded.c \ + btstack_em9304_spi_embedded.c \ + btstack_run_loop_embedded.c \ + btstack_stdin_embedded.c \ + btstack_tlv_flash_bank.c \ + btstack_uart_block_embedded.c \ + hal_flash_bank_memory.c \ + btstack_run_loop.c \ + hci_dump.c \ + +COMMON_OBJ = $(COMMON:.c=.o) + +all: embedded_test + +embedded_test: ${COMMON_OBJ} embedded_test.c + ${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@ + +test: all + ./embedded_test + +clean: + rm -f embedded_test + rm -f *.o + rm -rf *.dSYM + rm -f *.gcno *.gcda + diff --git a/test/embedded/embedded_test.c b/test/embedded/embedded_test.c new file mode 100644 index 000000000..f44b3c828 --- /dev/null +++ b/test/embedded/embedded_test.c @@ -0,0 +1,70 @@ +#include +#include +#include +#include + +#include "CppUTest/TestHarness.h" +#include "CppUTest/CommandLineTestRunner.h" + +#include "ble/att_db.h" +#include "ble/att_db_util.h" +#include "btstack_util.h" +#include "bluetooth.h" + +#include "hal_audio.h" +#include "hal_cpu.h" +#include "hal_em9304_spi.h" +#include "hal_flash_bank.h" +#include "hal_flash_bank_memory.h" +#include "hal_led.h" +#include "hal_stdin.h" +#include "hal_tick.h" +#include "hal_time_ms.h" +#include "hal_uart_dma.h" + +// quick mock + +// hal_cpu +void hal_cpu_disable_irqs(void){} +void hal_cpu_enable_irqs(void){} +void hal_cpu_enable_irqs_and_sleep(void){} + +// hal_em9304_spi +void hal_em9304_spi_init(void){} +void hal_em9304_spi_deinit(void){} +void hal_em9304_spi_set_ready_callback(void (*callback)(void)){} +void hal_em9304_spi_set_transfer_done_callback(void (*callback)(void)){} +void hal_em9304_spi_enable_ready_interrupt(void){} +void hal_em9304_spi_disable_ready_interrupt(void){} +int hal_em9304_spi_get_ready(){ return 0; } +void hal_em9304_spi_set_chip_select(int enable){} +int hal_em9304_spi_get_fullduplex_support(void){ return 0; } +void hal_em9304_spi_transceive(const uint8_t * tx_data, uint8_t * rx_data, uint16_t len){} +void hal_em9304_spi_transmit(const uint8_t * tx_data, uint16_t len){} +void hal_em9304_spi_receive(uint8_t * rx_data, uint16_t len){} + +// hal_stdin_setup +void hal_stdin_setup(void (*handler)(char c)){} + +// hal_uart_dma +void hal_uart_dma_init(void){} +void hal_uart_dma_set_block_received( void (*callback)(void)){} +void hal_uart_dma_set_block_sent( void (*callback)(void)){} +int hal_uart_dma_set_baud(uint32_t baud){ return 0; } +int hal_uart_dma_set_flowcontrol(int flowcontrol){ return 0;} +void hal_uart_dma_send_block(const uint8_t *buffer, uint16_t length){} +void hal_uart_dma_receive_block(uint8_t *buffer, uint16_t len){} +void hal_uart_dma_set_csr_irq_handler( void (*csr_irq_handler)(void)){} +void hal_uart_dma_set_sleep(uint8_t sleep){} +int hal_uart_dma_get_supported_sleep_modes(void){ return 0; } +// void hal_uart_dma_set_sleep_mode(btstack_uart_sleep_mode_t sleep_mode){} + + +TEST_GROUP(Embedded){ + void setup(void){ + } +}; + +int main (int argc, const char * argv[]){ + return CommandLineTestRunner::RunAllTests(argc, argv); +}