diff --git a/cmake/Platform/rt-kernel.cmake b/cmake/Platform/rt-kernel.cmake index 613f5a2..f6fe2f9 100644 --- a/cmake/Platform/rt-kernel.cmake +++ b/cmake/Platform/rt-kernel.cmake @@ -41,7 +41,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MACHINE_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MACHINE_FLAGS}" CACHE STRING "" FORCE) # Default libs -set(RTK_LIBS "-l${BSP} -l${ARCH} -lkern -ldev -lsio -lblock -lfs -lusb -llwip -lptpd -leth -li2c -lrtc -lcan -lnand -lspi -lnor -lpwm -ladc -ltrace -lcounter -lc -lm") +set(RTK_LIBS "-l${BSP} -l${ARCH} -lkern -ldev -lsio -lblock -lfs -lusb -llwip -lptpd -leth -li2c -lrtc -lcan -lnand -lspi -lnor -lpwm -ladc -ltrace -lcounter -lc -lm -lshell") set(CMAKE_CXX_LINK_EXECUTABLE " -o -nostartfiles -T${RTK}/bsp/${BSP}/${BSP}.ld -Wl,--start-group ${RTK_LIBS} -Wl,--end-group") set(CMAKE_C_LINK_EXECUTABLE " -o -nostartfiles -T${RTK}/bsp/${BSP}/${BSP}.ld -Wl,--start-group ${RTK_LIBS} -Wl,--end-group") diff --git a/soes/hal/rt-kernel-twrk60/esc_hw.c b/soes/hal/rt-kernel-twrk60/esc_hw.c index 9da437b..b737e05 100644 --- a/soes/hal/rt-kernel-twrk60/esc_hw.c +++ b/soes/hal/rt-kernel-twrk60/esc_hw.c @@ -16,6 +16,8 @@ #include #include +#define MAX_READ_SIZE 128 + #define ESC_CMD_READ 0x02 #define ESC_CMD_READWS 0x03 #define ESC_CMD_WRITE 0x04 @@ -24,7 +26,7 @@ #define ESC_NEXT 0x00 static int et1100 = -1; -static uint8_t read_termination[MAX(sizeof(Wb), 128)] = { 0 }; +static uint8_t read_termination[MAX_READ_SIZE] = { 0 }; #define GPIO_ECAT_RESET 1 /* specific function to hold ESC reset on startup * when emulating EEPROM @@ -56,7 +58,7 @@ static void esc_address (uint16_t address, uint8_t command) */ void ESC_read (uint16_t address, void *buf, uint16_t len) { - ASSERT(len <= sizeof(read_termination)); + ASSERT(len <= MAX_READ_SIZE); /* Select device. */ spi_select (et1100); @@ -69,7 +71,7 @@ void ESC_read (uint16_t address, void *buf, uint16_t len) * Read (and write termination bytes). */ spi_bidirectionally_transfer (et1100, buf, read_termination + - (sizeof(read_termination) - len), len); + (MAX_READ_SIZE - len), len); /* Un-select device. */ spi_unselect (et1100); @@ -122,5 +124,5 @@ void ESC_init (const esc_cfg_t * config) { const char * spi_name = (char *)config->user_arg; et1100 = open (spi_name, O_RDWR, 0); - read_termination[sizeof(read_termination) - 1] = 0xFF; + read_termination[MAX_READ_SIZE - 1] = 0xFF; } diff --git a/soes/include/sys/gcc/cc.h b/soes/include/sys/gcc/cc.h index 35420ec..0d8d253 100644 --- a/soes/include/sys/gcc/cc.h +++ b/soes/include/sys/gcc/cc.h @@ -33,7 +33,11 @@ extern "C" #define CC_PACKED_END #define CC_PACKED __attribute__((packed)) +#ifdef __rtk__ +#define CC_ASSERT(exp) ASSERT (exp) +#else #define CC_ASSERT(exp) assert (exp) +#endif #define CC_STATIC_ASSERT(exp) _Static_assert (exp, "") #define CC_DEPRECATED __attribute__((deprecated)) @@ -66,7 +70,8 @@ extern "C" #endif #ifdef ESC_DEBUG -#define DPRINT(...) rprintp ("esc_foe: "__VA_ARGS__) /* TODO */ +#include +#define DPRINT(...) rprintp ("soes: "__VA_ARGS__) /* TODO */ #else #define DPRINT(...) #endif /* DEBUG */