diff --git a/port/stm32-f4discovery-cc256x/port/port.c b/port/stm32-f4discovery-cc256x/port/port.c index 5eabe061c..2346d913b 100644 --- a/port/stm32-f4discovery-cc256x/port/port.c +++ b/port/stm32-f4discovery-cc256x/port/port.c @@ -218,9 +218,7 @@ void hal_uart_dma_receive_block(uint8_t *data, uint16_t size){ * @param len * @return */ -#include -#include -#include + ssize_t _write(int file, const void *buf, size_t len); ssize_t _write(int file, const void *buf, size_t len){ #if 1 diff --git a/port/stm32-f4discovery-usb/port/port.c b/port/stm32-f4discovery-usb/port/port.c index 4511177bc..4da17a6da 100644 --- a/port/stm32-f4discovery-usb/port/port.c +++ b/port/stm32-f4discovery-usb/port/port.c @@ -37,6 +37,10 @@ #define BTSTACK_FILE__ "port.c" +#include +#include +#include + // include STM32 first to avoid warning about redefinition of UNUSED #include "stm32f4xx_hal.h" #include "main.h" @@ -104,6 +108,43 @@ void hal_cpu_enable_irqs_and_sleep(void){ int btstack_main(int argc, char ** argv); +ssize_t _read(int fd, void * buf, size_t count){ + UNUSED(fd); + UNUSED(buf); + UNUSED(count); + return -1; +} + +int _close(int file){ + UNUSED(file); + return -1; +} + +int _isatty(int file){ + UNUSED(file); + return -1; +} + +int _lseek(int file){ + UNUSED(file); + return -1; +} + +int _fstat(int file){ + UNUSED(file); + return -1; +} + +int _kill (pid_t pid, int sig) { + UNUSED(pid); + UNUSED(sig); + return -1; +} + +pid_t _getpid (void) { + return 0; +} + // main.c static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ UNUSED(size); diff --git a/port/stm32-l451-miromico-sx1280/port/btstack_port.c b/port/stm32-l451-miromico-sx1280/port/btstack_port.c index b90653636..f6122f101 100644 --- a/port/stm32-l451-miromico-sx1280/port/btstack_port.c +++ b/port/stm32-l451-miromico-sx1280/port/btstack_port.c @@ -39,7 +39,10 @@ #define DEBUG +#include #include +#include +#include // to get cpu intrinsics, .e.g __dissble_irq(), before BTstack includes to avoid re-defining UNUSED #include "stm32l4xx.h" @@ -65,6 +68,43 @@ #include "hci_dump_embedded_stdout.h" #endif +ssize_t _read(int fd, void * buf, size_t count){ + UNUSED(fd); + UNUSED(buf); + UNUSED(count); + return -1; +} + +int _close(int file){ + UNUSED(file); + return -1; +} + +int _isatty(int file){ + UNUSED(file); + return -1; +} + +int _lseek(int file){ + UNUSED(file); + return -1; +} + +int _fstat(int file){ + UNUSED(file); + return -1; +} + +int _kill (pid_t pid, int sig) { + UNUSED(pid); + UNUSED(sig); + return -1; +} + +pid_t _getpid (void) { + return 0; +} + void btstack_assert_failed(const char * file, uint16_t line_nr){ printf("Assert: file %s, line %u\n", file, line_nr); while (1); diff --git a/port/stm32-l476rg-nucleo-sx1280/port/btstack_port.c b/port/stm32-l476rg-nucleo-sx1280/port/btstack_port.c index b90653636..f6122f101 100644 --- a/port/stm32-l476rg-nucleo-sx1280/port/btstack_port.c +++ b/port/stm32-l476rg-nucleo-sx1280/port/btstack_port.c @@ -39,7 +39,10 @@ #define DEBUG +#include #include +#include +#include // to get cpu intrinsics, .e.g __dissble_irq(), before BTstack includes to avoid re-defining UNUSED #include "stm32l4xx.h" @@ -65,6 +68,43 @@ #include "hci_dump_embedded_stdout.h" #endif +ssize_t _read(int fd, void * buf, size_t count){ + UNUSED(fd); + UNUSED(buf); + UNUSED(count); + return -1; +} + +int _close(int file){ + UNUSED(file); + return -1; +} + +int _isatty(int file){ + UNUSED(file); + return -1; +} + +int _lseek(int file){ + UNUSED(file); + return -1; +} + +int _fstat(int file){ + UNUSED(file); + return -1; +} + +int _kill (pid_t pid, int sig) { + UNUSED(pid); + UNUSED(sig); + return -1; +} + +pid_t _getpid (void) { + return 0; +} + void btstack_assert_failed(const char * file, uint16_t line_nr){ printf("Assert: file %s, line %u\n", file, line_nr); while (1); diff --git a/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c b/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c index aa29f7bfa..c2ad94331 100644 --- a/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c +++ b/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include "btstack_config.h" #include "main.h" @@ -61,11 +63,12 @@ *******************************************/ extern UART_HandleTypeDef hTuart; -int _write(int file, char* ptr, int len) +ssize_t _write(int fd, const void* buf, size_t count) { + const uint8_t *ptr = buf; // expand '/n' to '/r/n' int pos; - for (pos=0;pos