Index: apps/dumpmalloc/SOURCES |
— | — | @@ -0,0 +1 @@ |
| 2 | +main.c
|
Index: apps/dumpmalloc/ls.x |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +ENTRY(__emcore_entrypoint)
|
| 3 | +OUTPUT_FORMAT(elf32-littlearm)
|
| 4 | +OUTPUT_ARCH(arm)
|
| 5 | +
|
| 6 | +MEMORY
|
| 7 | +{
|
| 8 | + VIRTUAL : ORIGIN = 0x00000000, LENGTH = 0x10000000
|
| 9 | +}
|
| 10 | +
|
| 11 | +SECTIONS
|
| 12 | +{
|
| 13 | + .text :
|
| 14 | + {
|
| 15 | + __emcore_app_base = .;
|
| 16 | + KEEP(.emcoreentrypoint*)
|
| 17 | + *(.emcoreentrypoint*)
|
| 18 | + *(.text*)
|
| 19 | + *(.glue_7)
|
| 20 | + *(.glue_7t)
|
| 21 | + . = ALIGN(0x10);
|
| 22 | + } > VIRTUAL
|
| 23 | +
|
| 24 | + .data :
|
| 25 | + {
|
| 26 | + *(.rodata*)
|
| 27 | + . = ALIGN(0x4);
|
| 28 | + *(.data*)
|
| 29 | + . = ALIGN(0x4);
|
| 30 | + } > VIRTUAL
|
| 31 | +
|
| 32 | + .bss (NOLOAD) :
|
| 33 | + {
|
| 34 | + *(.bss*)
|
| 35 | + *(COMMON)
|
| 36 | + } > VIRTUAL
|
| 37 | +
|
| 38 | + /DISCARD/ :
|
| 39 | + {
|
| 40 | + *(.eh_frame)
|
| 41 | + }
|
| 42 | +
|
| 43 | +}
|
Index: apps/dumpmalloc/main.c |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +#include "emcoreapp.h"
|
| 3 | +
|
| 4 | +
|
| 5 | +static void main()
|
| 6 | +{
|
| 7 | + cputs(2, "Memory map:\n");
|
| 8 | + malloc_walk(NULL, (void*)2);
|
| 9 | + cputc(2, '\n');
|
| 10 | +}
|
| 11 | +
|
| 12 | +
|
| 13 | +EMCORE_APP_HEADER("Memory allocation dumper", main, 127)
|
Index: apps/dumpmalloc/version.h |
— | — | @@ -0,0 +1,36 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2010 TheSeven
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emBIOS.
|
| 8 | +//
|
| 9 | +// emBIOS is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emBIOS is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#ifndef __VERSION_H__
|
| 26 | +#define __VERSION_H__
|
| 27 | +
|
| 28 | +
|
| 29 | +#define VERSION "0.0.1pre"
|
| 30 | +#define VERSION_MAJOR 0
|
| 31 | +#define VERSION_MINOR 0
|
| 32 | +#define VERSION_PATCH 1
|
| 33 | +#define VERSION_SVN "$REVISION$"
|
| 34 | +#define VERSION_SVN_INT $REVISIONINT$
|
| 35 | +
|
| 36 | +
|
| 37 | +#endif |
\ No newline at end of file |
Index: apps/dumpmalloc/Makefile |
— | — | @@ -0,0 +1,120 @@ |
| 2 | +NAME := dumpmalloc
|
| 3 | +STACKSIZE := 4096
|
| 4 | +COMPRESS := true
|
| 5 | +
|
| 6 | +EMCOREDIR ?= ../../emcore/trunk/
|
| 7 | +
|
| 8 | +ifeq ($(shell uname),WindowsNT)
|
| 9 | +CCACHE :=
|
| 10 | +else
|
| 11 | +CCACHE := $(shell which ccache)
|
| 12 | +endif
|
| 13 | +
|
| 14 | +CROSS ?= arm-elf-eabi-
|
| 15 | +CC := $(CCACHE) $(CROSS)gcc
|
| 16 | +AS := $(CROSS)as
|
| 17 | +LD := $(CROSS)ld
|
| 18 | +OBJCOPY := $(CROSS)objcopy
|
| 19 | +ELF2ECA := $(CROSS)elf2emcoreapp
|
| 20 | +
|
| 21 | +LIBINCLUDES :=
|
| 22 | +
|
| 23 | +CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4
|
| 24 | +LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
|
| 25 | +
|
| 26 | +preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
| 27 | +preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
|
| 28 | +
|
| 29 | +REVISION := $(shell svnversion .)
|
| 30 | +REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
| 31 | +
|
| 32 | +HELPERS := build/__emcore_armhelpers.o
|
| 33 | +
|
| 34 | +SRC := $(call preprocesspaths,SOURCES,-I. -I..)
|
| 35 | +OBJ := $(SRC:%.c=build/%.o)
|
| 36 | +OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
|
| 37 | +
|
| 38 | +all: $(NAME)
|
| 39 | +
|
| 40 | +-include $(OBJ:%=%.dep)
|
| 41 | +
|
| 42 | +$(NAME): build/$(NAME).emcoreapp
|
| 43 | +
|
| 44 | +build/$(NAME).emcoreapp: build/$(NAME).elf
|
| 45 | + @echo [EMCAPP] $<
|
| 46 | +ifeq ($(COMPRESS),true)
|
| 47 | + @$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
|
| 48 | +else
|
| 49 | + @$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
|
| 50 | +endif
|
| 51 | +
|
| 52 | +build/$(NAME).elf: ls.x $(OBJ)
|
| 53 | + @echo [LD] $@
|
| 54 | + @$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
|
| 55 | +
|
| 56 | +build/%.o: %.c build/version.h
|
| 57 | + @echo [CC] $<
|
| 58 | +ifeq ($(shell uname),WindowsNT)
|
| 59 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 60 | +else
|
| 61 | + @-mkdir -p $(dir $@)
|
| 62 | +endif
|
| 63 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 64 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 65 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 66 | +ifeq ($(shell uname),WindowsNT)
|
| 67 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 68 | +else
|
| 69 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 70 | +endif
|
| 71 | + @rm -f $@.dep.tmp
|
| 72 | +
|
| 73 | +build/%.o: %.S build/version.h
|
| 74 | + @echo [CC] $<
|
| 75 | +ifeq ($(shell uname),WindowsNT)
|
| 76 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 77 | +else
|
| 78 | + @-mkdir -p $(dir $@)
|
| 79 | +endif
|
| 80 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 81 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 82 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 83 | +ifeq ($(shell uname),WindowsNT)
|
| 84 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 85 | +else
|
| 86 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 87 | +endif
|
| 88 | + @rm -f $@.dep.tmp
|
| 89 | +
|
| 90 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.c
|
| 91 | + @echo [CC] $<
|
| 92 | +ifeq ($(shell uname),WindowsNT)
|
| 93 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 94 | +else
|
| 95 | + @-mkdir -p $(dir $@)
|
| 96 | +endif
|
| 97 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 98 | +
|
| 99 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.S
|
| 100 | + @echo [CC] $<
|
| 101 | +ifeq ($(shell uname),WindowsNT)
|
| 102 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 103 | +else
|
| 104 | + @-mkdir -p $(dir $@)
|
| 105 | +endif
|
| 106 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 107 | +
|
| 108 | +build/version.h: version.h .svn/entries
|
| 109 | + @echo [PP] $<
|
| 110 | +ifeq ($(shell uname),WindowsNT)
|
| 111 | + @-if not exist build md build
|
| 112 | + @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| 113 | +else
|
| 114 | + @-mkdir -p build
|
| 115 | + @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| 116 | +endif
|
| 117 | +
|
| 118 | +clean:
|
| 119 | + @rm -rf build
|
| 120 | +
|
| 121 | +.PHONY: all clean $(NAME)
|
Index: apps/dumpmalloc |
Property changes on: apps/dumpmalloc |
___________________________________________________________________ |
Added: svn:ignore |
## -0,0 +1 ## |
| 122 | +build |