Commit ebd3e289 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

mpmalloc

parent 6d8a58ae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ COMMON_FLAGS += -mcpu=${CPU} -mmcu=${MCU} -DMULTIPASS_ARCH_msp430fr5994lp
COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C

ifneq (${msp430_large}, )
	COMMON_FLAGS += -mcode-region=either -mlarge
	COMMON_FLAGS += -mcode-region=either -mlarge -DADDR_20BIT
endif

# LTO seems to be broken.

src/lib/mpmalloc.cc

0 → 100644
+28 −0
Original line number Diff line number Diff line
#include <stdlib.h>
#include "driver/stdout.h"
#include "lib/mpmalloc.h"

void* mpcalloc(size_t nmemb, size_t size) {
	void* ret = calloc(nmemb, size);
#ifdef ADDR_20BIT
	kout << "calloc:" << dec << (uint32_t)nmemb << "x" << (uint32_t)size << "@" << ret << endl;
#else
	kout << "calloc:" << dec << nmemb << "x" << size << "@" << ret << endl;
#endif
	return ret;
}

void* mpmalloc(size_t size) {
	void* ret = malloc(size);
#ifdef ADDR_20BIT
	kout << "malloc:" << dec << (uint32_t)size << "@" << ret << endl;
#else
	kout << "malloc:" << dec << size << "@" << ret << endl;
#endif
	return ret;
}

void mpfree(void* addr) {
	kout << "free:" << addr << endl;
	free(addr);
}