setup ultra_trail fw based on bare-metal-bsp
This commit is contained in:
@ -7,12 +7,13 @@
|
||||
|
||||
#include "platform.h"
|
||||
#include "stub.h"
|
||||
#include "weak_under_alias.h"
|
||||
|
||||
ssize_t __wrap_read(int fd, void* ptr, size_t len)
|
||||
{
|
||||
uint8_t * current = (uint8_t *)ptr;
|
||||
volatile uint32_t * uart_rx = (uint32_t *)(UART0_BASE_ADDR + UART_REG_RXFIFO);
|
||||
volatile uint8_t * uart_rx_cnt = (uint8_t *)(UART0_BASE_ADDR + UART_REG_RXCTRL + 2);
|
||||
volatile uint32_t * uart_rx = (uint32_t *)(UART0_CTRL_ADDR + UART_REG_RXFIFO);
|
||||
volatile uint8_t * uart_rx_cnt = (uint8_t *)(UART0_CTRL_ADDR + UART_REG_RXCTRL + 2);
|
||||
|
||||
ssize_t result = 0;
|
||||
|
||||
@ -28,3 +29,4 @@ ssize_t __wrap_read(int fd, void* ptr, size_t len)
|
||||
|
||||
return _stub(EBADF);
|
||||
}
|
||||
weak_under_alias(read);
|
||||
|
7
bare-metal-bsp/libwrap/sys/weak_under_alias.h
Normal file
7
bare-metal-bsp/libwrap/sys/weak_under_alias.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H
|
||||
#define _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H
|
||||
|
||||
#define weak_under_alias(name) \
|
||||
extern __typeof (__wrap_##name) __wrap__##name __attribute__ ((weak, alias ("__wrap_"#name)))
|
||||
|
||||
#endif
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "platform.h"
|
||||
#include "stub.h"
|
||||
#include "weak_under_alias.h"
|
||||
|
||||
ssize_t __wrap_write(int fd, const void* ptr, size_t len)
|
||||
{
|
||||
@ -27,3 +28,4 @@ ssize_t __wrap_write(int fd, const void* ptr, size_t len)
|
||||
|
||||
return _stub(EBADF);
|
||||
}
|
||||
weak_under_alias(write);
|
||||
|
Reference in New Issue
Block a user