alloc pamięć

This commit is contained in:
borysr 2024-05-22 13:11:23 +02:00
parent 0c913190f0
commit 5e402eff2a
9 changed files with 7592 additions and 31 deletions

Binary file not shown.

View File

@ -14,7 +14,7 @@ _start:
# Clear the bss segment # Clear the bss segment
la a0, __bss_start la a0, __bss_start
la a1, __BSS_END__ la a1, __BSS_END__
j finish_bss
clear_bss: clear_bss:
bgeu a0, a1, finish_bss bgeu a0, a1, finish_bss
sb x0, 0(a0) sb x0, 0(a0)

BIN
cpp/_crt0.o Normal file

Binary file not shown.

View File

@ -1,8 +1,5 @@
#include <stdint.h> #include <stdint.h>
char * ptr1 = "janek";
char * ptr2 = "kowalskii";
int strlen(char *s) int strlen(char *s)
{ {
char *p = s; char *p = s;
@ -39,35 +36,13 @@ char *alloc(int n)
int main() { int main() {
char * s = "mpabi";
struct key{
char *word;
int8_t count;
} keytab[10];
uint8_t wynik =0; struct key * Ptr = (struct key *) alloc(100);
wynik = strlen (s);
asm("nop");
char * p1 = alloc(strlen(ptr1));
strcpy (p1, ptr1);
asm("nop");
char * p2 = alloc(strlen(ptr2));
strcpy (p2, ptr2);
asm("nop");
struct point {
int16_t x;
int16_t y;
};
struct point * ptrS = (struct point *) alloc(sizeof(point));
ptrS->x=0x10;
ptrS->y=0x20;
asm("nop");
(*ptrS).y= strlen (p1)+ strlen(p2);
return 1; return 1;
} }

BIN
cpp/_rvmain.o Normal file

Binary file not shown.

BIN
cpp/myfunc.o Normal file

Binary file not shown.

BIN
cpp/prog Executable file

Binary file not shown.

BIN
cpp/prog.bin Executable file

Binary file not shown.

7586
cpp/prog.lst Normal file

File diff suppressed because it is too large Load Diff