further semihosting support

This commit is contained in:
gabriel
2024-04-30 08:48:44 +02:00
parent e83f7996bc
commit 9aaf428620
9 changed files with 57 additions and 32 deletions

View File

@@ -5,6 +5,8 @@
#include <unistd.h>
#include <sys/types.h>
#include "../../include/tgc-vp/devices/uart.h"
#include "../../env/tgc-vp/platform.h"
#include "platform.h"
#include "stub.h"
#include "weak_under_alias.h"
@@ -12,11 +14,19 @@
ssize_t __wrap_write(int fd, const void* ptr, size_t len)
{
const uint8_t * current = (const uint8_t *)ptr;
const uint8_t * current = (const uint8_t *)ptr;
#if defined(SEMIHOSTING)
sh_write(current, fd);
return len;
#endif
if(isatty(fd)) {
for (size_t jj = 0; jj < len; jj++) {
sh_writec(current[jj]);
}
return len;
} else {
sh_write(current, fd);
return len;
}
//return len;
#endif
if (isatty(fd)) {
for (size_t jj = 0; jj < len; jj++) {
#if defined(BOARD_ehrenberg)