This commit is contained in:
mpabi 2024-07-03 16:14:36 +00:00
parent 1f0ce9a26b
commit 81c86f0d2d
2 changed files with 38 additions and 3 deletions

View File

@ -5,7 +5,8 @@ MULDIV=no
SRCS = $(wildcard src/*.c) \ SRCS = $(wildcard src/*.c) \
$(wildcard src/*.cpp) \ $(wildcard src/*.cpp) \
$(wildcard src/*.S) $(wildcard src/*.S) \
src/stub_stdlib.c
OBJDIR = build OBJDIR = build
@ -39,8 +40,8 @@ ifeq ($(COMPRESSED),yes)
MARCH := $(MARCH)ac MARCH := $(MARCH)ac
endif endif
CFLAGS += -march=$(MARCH) -mabi=$(MABI) -DNDEBUG CFLAGS += -march=$(MARCH) -mabi=$(MABI) -DNDEBUG -std=c++11 -fno-pic -ffreestanding
LDFLAGS += -march=$(MARCH) -mabi=$(MABI) LDFLAGS += -march=$(MARCH) -mabi=$(MABI) -lc -lgcc -nostdlib -nostartfiles -nostartfiles

View File

@ -14,6 +14,8 @@
#include "murax.h" #include "murax.h"
#include <cstddef> #include <cstddef>
#include <initializer_list>
#include <cstdio>
void print(const char*str){ void print(const char*str){
while(*str){ while(*str){
@ -46,6 +48,14 @@ private:
}; };
const Timer_Reg* TimeR::ptr = reinterpret_cast<const Timer_Reg*>(0xF0020040); const Timer_Reg* TimeR::ptr = reinterpret_cast<const Timer_Reg*>(0xF0020040);
// --- // ---
@ -64,8 +74,32 @@ int len( const char * str) {
*/ */
int32_t ile = 0; int32_t ile = 0;
int myfunc(const char *s)
{
int i = 0;
// sum up all the character codes in the string
while (*s)
i += *s++;
return i;
}
void test (std::initializer_list<int> vals) {
char buffer[50];
for (auto p = vals.begin(); p != vals.end(); ++p) {
std::sprintf(buffer, "%d\n", *p);
// printf("%s", buffer);
}
}
int main() { int main() {
char str[10] = {1,2,3};
myfunc(str);
// println("hello world arty a7 v1"); // println("hello world arty a7 v1");