Compare commits
4 Commits
fbe6560e79
...
3042e0e124
Author | SHA1 | Date | |
---|---|---|---|
3042e0e124 | |||
8bb7365819 | |||
c83b10df38 | |||
24b64bce3e |
28
env/iss/bsp_write.c
vendored
28
env/iss/bsp_write.c
vendored
@ -5,12 +5,32 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
extern volatile uint32_t tohost;
|
||||||
|
|
||||||
ssize_t _bsp_write(int fd, const void *ptr, size_t len) {
|
ssize_t _bsp_write(int fd, const void *ptr, size_t len) {
|
||||||
const uint8_t *current = (const uint8_t *)ptr;
|
|
||||||
|
// char string[] = "hello world in bsp_write";
|
||||||
|
// uint32_t payload_1[4] = {64, 0, (uintptr_t)string, strlen(string)};
|
||||||
|
// tohost = (uint32_t)payload_1;
|
||||||
|
|
||||||
|
// const uint32_t *current = (const uint32_t *)ptr;
|
||||||
|
|
||||||
if (isatty(fd)) {
|
if (isatty(fd)) {
|
||||||
for (size_t jj = 0; jj < len; jj++) {
|
// uint32_t payload[4] = {64, 0, (uint32_t)((uint32_t *)ptr), len};
|
||||||
*((uint32_t *)0xFFFF0000) = current[jj];
|
// tohost = (uint32_t)payload;
|
||||||
}
|
|
||||||
|
uint64_t payload[4] = {64, 0, (uintptr_t)((uint32_t *)ptr), len};
|
||||||
|
tohost = (uint32_t)payload;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// accoring to my understading this part is used fot uart wrrite for later
|
||||||
|
for (size_t jj = 0; jj < len; jj++) {
|
||||||
|
*((uint32_t *)0xFFFF0000) = current[jj];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
env/iss/link.lds
vendored
22
env/iss/link.lds
vendored
@ -13,6 +13,7 @@ PHDRS
|
|||||||
flash PT_LOAD;
|
flash PT_LOAD;
|
||||||
ram_init PT_LOAD;
|
ram_init PT_LOAD;
|
||||||
ram PT_NULL;
|
ram PT_NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
@ -123,22 +124,30 @@ SECTIONS
|
|||||||
*(.gnu.linkonce.d.*)
|
*(.gnu.linkonce.d.*)
|
||||||
} >ram AT>flash :ram_init
|
} >ram AT>flash :ram_init
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.sdata :
|
||||||
|
{
|
||||||
|
|
||||||
|
__SDATA_BEGIN__ = .;
|
||||||
|
*(.sdata .sdata.*)
|
||||||
|
*(.gnu.linkonce.s.*)
|
||||||
|
|
||||||
|
} >ram AT>flash :ram_init
|
||||||
|
|
||||||
|
|
||||||
.srodata :
|
.srodata :
|
||||||
{
|
{
|
||||||
|
|
||||||
PROVIDE( _gp = . + 0x800 );
|
PROVIDE( _gp = . + 0x800 );
|
||||||
*(.srodata.cst16)
|
*(.srodata.cst16)
|
||||||
*(.srodata.cst8)
|
*(.srodata.cst8)
|
||||||
*(.srodata.cst4)
|
*(.srodata.cst4)
|
||||||
*(.srodata.cst2)
|
*(.srodata.cst2)
|
||||||
*(.srodata .srodata.*)
|
*(.srodata .srodata.*)
|
||||||
|
|
||||||
} >ram AT>flash :ram_init
|
} >ram AT>flash :ram_init
|
||||||
|
|
||||||
.sdata :
|
|
||||||
{
|
|
||||||
__SDATA_BEGIN__ = .;
|
|
||||||
*(.sdata .sdata.*)
|
|
||||||
*(.gnu.linkonce.s.*)
|
|
||||||
} >ram AT>flash :ram_init
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
PROVIDE( _edata = . );
|
PROVIDE( _edata = . );
|
||||||
@ -172,3 +181,4 @@ SECTIONS
|
|||||||
PROVIDE( tohost = 0xfffffff0 );
|
PROVIDE( tohost = 0xfffffff0 );
|
||||||
PROVIDE( fromhost = 0xfffffff8 );
|
PROVIDE( fromhost = 0xfffffff8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
env/tgc_vp
vendored
2
env/tgc_vp
vendored
@ -1 +1 @@
|
|||||||
ehrenberg
|
moonlight/
|
@ -6,6 +6,6 @@ extern ssize_t _bsp_write(int, const void *, size_t);
|
|||||||
|
|
||||||
int __wrap_puts(const char *s) {
|
int __wrap_puts(const char *s) {
|
||||||
int len = strlen(s);
|
int len = strlen(s);
|
||||||
return _bsp_write(0, s, len);
|
return _bsp_write(STDOUT_FILENO, s, len);
|
||||||
}
|
}
|
||||||
weak_under_alias(puts);
|
weak_under_alias(puts);
|
||||||
|
Reference in New Issue
Block a user