mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Liba cleanup
This commit is contained in:
2
Makefile
2
Makefile
@@ -50,7 +50,6 @@ products := boot.elf boot.hex boot.bin
|
||||
#objs += $(addprefix external/newlib/libc/, string/memset.o string/memcpy.o string/strlen.o)
|
||||
|
||||
lib/private/mem5.o: CFLAGS += -w
|
||||
objs += lib/errno.o lib/private/mem5.o lib/cxx_new.o
|
||||
|
||||
objs += src/hello.o
|
||||
|
||||
@@ -58,6 +57,7 @@ objs += src/hello.o
|
||||
default: clean boot.elf
|
||||
|
||||
include liba/Makefile
|
||||
include libaxx/Makefile
|
||||
include platform/Makefile
|
||||
include kandinsky/Makefile
|
||||
include poincare/Makefile
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/*#ifndef LIB_MALLOC_H
|
||||
#define LIB_MALLOC_H*/
|
||||
|
||||
extern "C" {
|
||||
#include <malloc.h>
|
||||
}
|
||||
|
||||
void * operator new (unsigned int size) {
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
/*#endif*/
|
||||
@@ -1,7 +0,0 @@
|
||||
int errno = 0;
|
||||
|
||||
/* Invalid argument */
|
||||
#define EINVAL 22
|
||||
|
||||
/* Not enough space */
|
||||
#define ENOMEM 12
|
||||
@@ -1,2 +1,5 @@
|
||||
SFLAGS += -Iliba/include
|
||||
objs += $(addprefix liba/src/, assert.o memcpy.o memset.o malloc.o)
|
||||
|
||||
liba/src/external/sqlite/mem5.o: CFLAGS += -w
|
||||
|
||||
objs += $(addprefix liba/src/, assert.o errno.o malloc.o memcpy.o memset.o external/sqlite/mem5.o)
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
extern int errno;
|
||||
#ifndef LIBA_ERRNO_H
|
||||
#define LIBA_ERRNO_H
|
||||
|
||||
/* Invalid argument */
|
||||
#define EINVAL 22
|
||||
|
||||
/* Not enough space */
|
||||
#define ENOMEM 12
|
||||
|
||||
extern int errno;
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LIB_MEM5CONFIG_H
|
||||
#define LIB_MEM5CONFIG_H
|
||||
#ifndef LIBA_MEMCONFIG_H
|
||||
#define LIBA_MEMCONFIG_H
|
||||
|
||||
/* This structure contains all the configuration data for the mem5 allocator.
|
||||
* Before using mem5, the HeapConfig global variable should be created
|
||||
@@ -1,5 +1,9 @@
|
||||
typedef void FILE;
|
||||
#ifndef LIBA_STDIO_H
|
||||
#define LIBA_STDIO_H
|
||||
|
||||
#define stdin 0
|
||||
#define stdout 0
|
||||
|
||||
typedef void FILE;
|
||||
|
||||
#endif
|
||||
3
liba/src/errno.c
Normal file
3
liba/src/errno.c
Normal file
@@ -0,0 +1,3 @@
|
||||
#include <errno.h>
|
||||
|
||||
int errno = 0;
|
||||
@@ -5,7 +5,7 @@
|
||||
* That file provides a tested implementation of malloc/free/realloc. */
|
||||
|
||||
#define sqlite3GlobalConfig HeapConfig
|
||||
#include "mem5config.h"
|
||||
#include <liba/include/private/memconfig.h>
|
||||
|
||||
/* SQLite wants to use its own integer types. Let's define them based from the
|
||||
* stdint ones */
|
||||
@@ -1,6 +1,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void memsys5FreeUnsafe(void *pOld);
|
||||
void * memsys5MallocUnsafe(int nByte);
|
||||
void * memsys5Realloc(void *pPrior, int nBytes);
|
||||
int memsys5Roundup(int n);
|
||||
|
||||
void free(void *ptr) {
|
||||
if (ptr != NULL) {
|
||||
memsys5FreeUnsafe(ptr);
|
||||
|
||||
@@ -5,4 +5,5 @@ void * memset(void * b, int c, size_t len) {
|
||||
while (len--) {
|
||||
*destination++ = (unsigned char)c;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
1
libaxx/Makefile
Normal file
1
libaxx/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
objs += $(addprefix libaxx/src/, new.o)
|
||||
3
libaxx/README.txt
Normal file
3
libaxx/README.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
libaxx is an adhoc libc++, just like liba is an adhoc libc.
|
||||
|
||||
See liba for more informations.
|
||||
5
libaxx/src/new.cpp
Normal file
5
libaxx/src/new.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
void * operator new (unsigned int size) {
|
||||
return malloc(size);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "init_lcd.h"
|
||||
#include <lib/private/mem5config.h>
|
||||
#include <private/memconfig.h>
|
||||
|
||||
extern char _ccm_heap_start;
|
||||
extern char _ccm_heap_end;
|
||||
|
||||
Reference in New Issue
Block a user