Changeset 162
- Timestamp:
- Jun 20, 2012, 5:11:11 PM (12 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 6 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r161 r162 1 export # export all variable to sub-Makefile 1 2 CC=mipsel-unknown-elf-gcc 2 3 AS=mipsel-unknown-elf-as … … 4 5 DU=mipsel-unknown-elf-objdump 5 6 6 SYS_OBJS = giet.o \ 7 8 #current directory absolute path 9 SOFT_PATH = $(shell pwd)/ 10 11 SYS_NAME = sys 12 BOOT_NAME = boot 13 LIB_NAME = libs 14 15 SYS_PATH = $(SOFT_PATH)$(SYS_NAME) 16 BOOT_PATH = $(SOFT_PATH)$(BOOT_NAME) 17 LIB_PATH = $(SOFT_PATH)$(LIB_NAME) 18 MAP_PATH = $(SOFT_PATH)xml/ 19 BUILD_PATH = $(SOFT_PATH)build/ 20 ELF_PATH = $(SOFT_PATH)build/ 21 22 #list of all applications directory 23 APP_DIRS = $(shell ls -d apps/*/ ) 24 25 SYS_OBJS_LIST = \ 26 sys_handler.o \ 27 init.o \ 28 giet.o \ 7 29 switch.o \ 8 30 common.o \ … … 11 33 exc_handler.o \ 12 34 irq_handler.o \ 13 sys_handler.o \14 init.o \15 35 task_init.o 16 36 17 BOOT_OBJS = reset.o \18 boot_handler.o37 BOOT_OBJS_LIST = reset.o \ 38 boot_handler.o 19 39 20 SYS_PATH = sys 21 BOOT_PATH = boot 22 MAP_PATH = xml 23 LIBS_PATH = libs 24 BUILD_DIR_NAME = build 40 #LIB_SRCS = $(wildcard $(LIB_NAME)/*.c) 41 LIB_OBJS_LIST = stdio.o\ 42 mwmr.o\ 43 common.o 44 45 LIB_OBJS = $(patsubst %,$(LIB_NAME)/%,$(LIB_OBJS_LIST)) 46 SYS_OBJS = $(patsubst %,$(SYS_NAME)/%,$(SYS_OBJS_LIST)) 47 BOOT_OBJS = $(patsubst %,$(BOOT_NAME)/%,$(BOOT_OBJS_LIST)) 48 25 49 26 50 CFLAGS=-Wall -ffreestanding -mno-gpopt -mips32 -g 27 51 28 SYS_INCLUDE = -I$(SYS_PATH) -I$(MAP_PATH) -I$(LIB S_PATH) -I.52 SYS_INCLUDE = -I$(SYS_PATH) -I$(MAP_PATH) -I$(LIB_PATH) -I. 29 53 30 BOOT_INCLUDE = -I$(BOOT_PATH) -I$(MAP_PATH) -I$(LIB S_PATH) -I.54 BOOT_INCLUDE = -I$(BOOT_PATH) -I$(MAP_PATH) -I$(LIB_PATH) -I. 31 55 32 #commons between sys and boot are: common.ld , mips_registers.h... 56 INCLUDE = -I$(LIB_PATH) -I$(SOFT_PATH) -I$(SYS_PATH) -I$(MAP_PATH) 33 57 34 58 TRASH= /dev/null||true … … 38 62 all: prepare soft.elf 39 63 40 41 64 ## merge all *.elf to soft.elf 42 65 soft.elf: boot.elf sys.elf map.bin apps 43 make-C mover44 mover/mover.x -smmap.bin45 $(DU) -D $@ > $ @.txt66 $(MAKE) -C mover 67 mover/mover.x map.bin 68 $(DU) -D $@ > $(BUILD_PATH)$@.txt 46 69 47 70 ## prepare the environement 48 71 prepare: 49 @mkdir $(BUILD_DIR_NAME) 2>$(TRASH) 72 @mkdir $(BUILD_PATH) 2>$(TRASH) 73 @mkdir $(ELF_PATH) 2>$(TRASH) 50 74 75 ## compile the parser 51 76 ## mapping compilation 52 77 map.bin: map.xml 53 make -C xml #compile the parser78 $(MAKE) -C xml 54 79 xml/xml2bin map.xml map.bin 55 80 56 81 ## system compilation 57 82 sys.elf: $(SYS_OBJS) $(SYS_PATH)/sys.ld 58 (cd $(BUILD_ DIR_NAME); $(LD) -o $@ -T ../$(SYS_PATH)/sys.ld $(SYS_OBJS) )59 (cd $(BUILD_ DIR_NAME); $(DU) -D $@ > $@.txt)83 (cd $(BUILD_PATH); $(LD) -o $@ -T $(SYS_PATH)/sys.ld $(SYS_OBJS) ) 84 (cd $(BUILD_PATH); $(DU) -D $@ > $@.txt) 60 85 61 switch.o: $(SYS_PATH)/switch.s giet_config.h 62 $(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $< 86 $(SYS_NAME)/%.o: $(SYS_NAME)/%.c 87 @mkdir $(BUILD_PATH)/$(SYS_NAME) 2>$(TRASH) 88 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 63 89 64 giet.o: $(SYS_PATH)/giet.s giet_config.h 65 $(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $< 90 $(SYS_NAME)/%.o: $(SYS_NAME)/%.s 91 @mkdir $(BUILD_PATH)/$(SYS_NAME) 2>$(TRASH) 92 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 66 93 67 task_init.o: $(SYS_PATH)/task_init.S giet_config.h 68 #$(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $< 69 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 70 $(DU) -D $(BUILD_DIR_NAME)/$@ > $(BUILD_DIR_NAME)/$@.txt 71 72 ctx_handler.o: $(SYS_PATH)/ctx_handler.c $(SYS_PATH)/ctx_handler.h giet_config.h 73 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 74 75 exc_handler.o: $(SYS_PATH)/exc_handler.c $(SYS_PATH)/exc_handler.h giet_config.h 76 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 77 78 irq_handler.o: $(SYS_PATH)/irq_handler.c $(SYS_PATH)/irq_handler.h giet_config.h 79 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 80 81 sys_handler.o: $(SYS_PATH)/sys_handler.c $(SYS_PATH)/sys_handler.h giet_config.h 82 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 83 84 drivers.o: $(SYS_PATH)/drivers.c $(SYS_PATH)/drivers.h giet_config.h 85 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 86 87 common.o: $(SYS_PATH)/common.c $(SYS_PATH)/common.h giet_config.h 88 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 89 90 init.o: $(SYS_PATH)/init.c giet_config.h 91 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 94 $(SYS_NAME)/%.o: $(SYS_NAME)/%.S 95 @mkdir $(BUILD_PATH)/$(SYS_NAME) 2>$(TRASH) 96 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 92 97 93 98 ## boot compilation 94 99 boot.elf: $(BOOT_OBJS) $(BOOT_PATH)/boot.ld 95 (cd $(BUILD_ DIR_NAME); $(LD) -o $@ -T ../$(BOOT_PATH)/boot.ld $(BOOT_OBJS) )96 (cd $(BUILD_ DIR_NAME); $(DU) -D $@ > $@.txt)100 (cd $(BUILD_PATH); $(LD) -o $@ -T $(BOOT_PATH)/boot.ld $(BOOT_OBJS) ) 101 (cd $(BUILD_PATH); $(DU) -D $@ > $@.txt) 97 102 98 reset.o: $(BOOT_PATH)/reset.S giet_config.h 99 $(CC) $(CFLAGS) $(BOOT_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $<100 $( DU) -D $(BUILD_DIR_NAME)/$@ > $(BUILD_DIR_NAME)/$@.txt103 $(BOOT_NAME)/%.o: $(BOOT_NAME)/%.c 104 @mkdir $(BUILD_PATH)/$(BOOT_NAME) 2>$(TRASH) 105 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 101 106 102 boot_handler.o: $(BOOT_PATH)/boot_handler.c $(BOOT_PATH)/boot_handler.h giet_config.h 103 $(CC) $(CFLAGS) $(BOOT_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 107 $(BOOT_NAME)/%.o: $(BOOT_NAME)/%.s 108 @mkdir $(BUILD_PATH)/$(BOOT_NAME) 2>$(TRASH) 109 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 104 110 105 ## applications and libs compilation 106 apps: 111 $(BOOT_NAME)/%.o: $(BOOT_NAME)/%.S 112 @mkdir $(BUILD_PATH)/$(BOOT_NAME) 2>$(TRASH) 113 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 114 115 ##libs compilation 116 $(LIB_NAME)/%.o: $(LIB_NAME)/%.c 117 @mkdir $(BUILD_PATH)/$(LIB_NAME) 2>$(TRASH) 118 $(CC) $(CFLAGS) $(INCLUDE) -c -o $(BUILD_PATH)/$@ $< 119 120 ## applications 121 apps: $(LIB_OBJS) 107 122 @echo "---------------------------------------------BUILDING APPS------------------------------------------------------" 108 make -C apps123 set -e; for d in $(APP_DIRS); do $(MAKE) -C $$d ; echo "Compiling $$d"; done 109 124 110 125 ### special rules 111 126 clean: 112 127 rm -f *.o *.elf *.bin *.txt core *~ 2>$(TRASH) 113 makeclean -C xml/ 2>$(TRASH)114 makeclean -C mover/ 2>$(TRASH)115 make clean -C apps2>$(TRASH)116 rm -r $(BUILD_DIR_NAME) 2>$(TRASH)128 $(MAKE) clean -C xml/ 2>$(TRASH) 129 $(MAKE) clean -C mover/ 2>$(TRASH) 130 rm -r $(BUILD_PATH) 2>$(TRASH) 131 set -e; for d in $(APP_DIRS); do $(MAKE) clean -C $$d ; done -
soft/giet_vm/apps/Makefile
r161 r162 1 1 # Compile the library and call the Makefile of each sub-directory. # 2 3 2 export # export all variable to sub-Makefile 4 3 CC = mipsel-unknown-elf-gcc … … 7 6 DU = mipsel-unknown-elf-objdump 8 7 9 CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 10 11 SOFT_PATH = $(shell cd ..; pwd)/ 12 13 LIB_PATH = $(SOFT_PATH)libs 14 SYS_PATH = $(SOFT_PATH)sys 15 DUMP_PATH = $(SOFT_PATH) #where goes the generated *.bin 16 MAP_PATH = $(SOFT_PATH)xml 17 BUILD_PATH = $(SOFT_PATH)/build/ 18 BIN_PATH = $(SOFT_PATH)/build/ 19 20 INCLUDE = -I$(LIB_PATH) -I$(SOFT_PATH) -I$(SYS_PATH) -I$(MAP_PATH) 8 CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 -g 21 9 22 10 TRASH= /dev/null||true … … 26 14 LIB_COMPILE+= common.o 27 15 16 SOFT_PATH = $(cd ..; shell pwd)/ 17 18 SYS_PATH = $(SOFT_PATH)sys/ 19 BOOT_PATH = $(SOFT_PATH)boot/ 20 MAP_PATH = $(SOFT_PATH)xml/ 21 LIBS_PATH = $(SOFT_PATH)libs/ 22 BUILD_PATH = $(SOFT_PATH)build/ 23 ELF_PATH = $(SOFT_PATH)build/ 24 25 INCLUDE = -I$(LIBS_PATH) -I$(SOFT_PATH) -I$(SYS_PATH) -I$(MAP_PATH) 26 28 27 DIRS=$(shell ls -d */ ) #list all directorys 29 30 28 31 29 .PHONY: prepare 32 30 33 all: prepare $(LIB_COMPILE)31 all: test prepare $(LIB_COMPILE) 34 32 set -e; for d in $(DIRS); do $(MAKE) -C $$d ; echo "Compiling $$d"; done 35 33 36 34 prepare: 37 35 @mkdir $(BUILD_PATH) 2>$(TRASH) 36 @mkdir $(ELF_PATH) 2>$(TRASH) 38 37 39 %.o : $(LIB _PATH)/%.c38 %.o : $(LIBS_PATH)/%.c 40 39 $(CC) $(CFLAGS) $(INCLUDE) -c -o $(BUILD_PATH)/$@ $< 41 40 … … 43 42 rm -f *.o 44 43 set -e; for d in $(DIRS); do $(MAKE) clean -C $$d ; done 45 -
soft/giet_vm/apps/fifo/Makefile
r161 r162 1 1 APP_NAME=fifo 2 3 OBJS= main.o 2 4 3 5 USE+= stdio.o 4 6 USE+= mwmr.o 5 7 6 USES=$(patsubst %,$(BUILD_PATH)%,$(USE)) 7 8 OBJS= main.o 8 USES=$(patsubst %,$(BUILD_PATH)/$(LIB_NAME)/%,$(USE)) 9 9 10 10 all: $(APP_NAME).elf 11 11 12 BIN_NAME_PATH=$( BIN_PATH)$(APP_NAME).elf12 BIN_NAME_PATH=$(ELF_PATH)$(APP_NAME).elf 13 13 14 14 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld … … 20 20 $(DU) -D $@ > $@.txt 21 21 22 23 22 clean: 24 23 rm -f *.o *.elf *.txt core *~ 2>$(TRASH) -
soft/giet_vm/apps/hello/Makefile
r161 r162 3 3 USE+= stdio.o 4 4 5 USES=$(patsubst %,$(BUILD_PATH) %,$(USE))5 USES=$(patsubst %,$(BUILD_PATH)/$(LIB_NAME)/%,$(USE)) 6 6 7 7 OBJS= main.o … … 9 9 all: $(APP_NAME).elf 10 10 11 BIN_NAME_PATH=$( BIN_PATH)$(APP_NAME).elf11 BIN_NAME_PATH=$(ELF_PATH)$(APP_NAME).elf 12 12 13 13 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld -
soft/giet_vm/apps/numsplit/Makefile
r161 r162 8 8 OBJS+= producer.o 9 9 10 USES=$(patsubst %,$(BUILD_PATH) %,$(USE))10 USES=$(patsubst %,$(BUILD_PATH)/$(LIB_NAME)/%,$(USE)) 11 11 SRCS=$(patsubst %.o,%.c,$(OBJS)) 12 12 … … 15 15 .PHONY: compile 16 16 17 BIN_NAME_PATH=$( BIN_PATH)$(APP_NAME).elf17 BIN_NAME_PATH=$(ELF_PATH)$(APP_NAME).elf 18 18 19 19 $(APP_NAME).elf: compile $(APP_NAME).ld -
soft/giet_vm/apps/numsplit/consumer.c
r160 r162 6 6 srl_mwmr_t input = GET_MWMR(mwmr); 7 7 char buf[BUF_SIZE]; 8 int i,x;8 //int i,x; 9 9 while(1) 10 10 { -
soft/giet_vm/apps/pgcd/Makefile
r161 r162 3 3 USE+= stdio.o 4 4 5 USES=$(patsubst %,$(BUILD_PATH) %,$(USE))5 USES=$(patsubst %,$(BUILD_PATH)/$(LIB_NAME)/%,$(USE)) 6 6 7 7 OBJS= main.o … … 9 9 all: $(APP_NAME).elf 10 10 11 BIN_NAME_PATH=$( BIN_PATH)$(APP_NAME).elf11 BIN_NAME_PATH=$(ELF_PATH)$(APP_NAME).elf 12 12 13 13 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld -
soft/giet_vm/apps/router/Makefile
r161 r162 4 4 USE+= mwmr.o 5 5 6 USES= $(patsubst %,$(BUILD_PATH)%,$(USE))6 USES=$(patsubst %,$(BUILD_PATH)/$(LIB_NAME)/%,$(USE)) 7 7 8 8 OBJS= main.o … … 10 10 all: $(APP_NAME).elf 11 11 12 BIN_NAME_PATH=$( BIN_PATH)$(APP_NAME).elf12 BIN_NAME_PATH=$(ELF_PATH)$(APP_NAME).elf 13 13 14 14 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld -
soft/giet_vm/boot/boot_handler.c
r160 r162 52 52 #include <boot_handler.h> 53 53 #include <mapping_info.h> 54 #include <hwr_mapping.h>55 54 #include <mwmr.h> 56 55 … … 80 79 { [0 ... GIET_NB_VSPACE_MAX-1] = 0 }; 81 80 82 // Page table pointer 81 // Page table pointers 83 82 page_table_t* _ptabs[GIET_NB_VSPACE_MAX]; 84 83 … … 149 148 } 150 149 boot_tty_puts(buf); 151 }152 153 unsigned int _tty_puts(const char *buffer, unsigned int length)154 {155 unsigned int* tty_address = (unsigned int*)&seg_tty_base;156 unsigned int n;157 158 for ( n=0; n<length; n++)159 {160 if (buffer[n] == 0) break;161 tty_address[0] = (unsigned int)buffer[n];162 }163 164 return n;165 }166 167 ////////////////////////////////////////////////////////////////////////////////////168 // tty_printf()169 // This function is a simplified version of the mutek_printf() function.170 // The terminal index must be defined in the calling task context.171 // It doesn't use the IRQ_PUT interrupt, and the associated kernel buffer.172 // Only a limited number of formats are supported:173 // - %d : signed decimal174 // - %u : unsigned decimal175 // - %x : hexadecimal176 // - %c : char177 // - %s : string178 // - Returns 0 if success, > 0 if error.179 ////////////////////////////////////////////////////////////////////////////////////180 unsigned int _tty_printf(char *format, ...)181 {182 va_list ap;183 va_start(ap, format);184 unsigned int ret;185 186 printf_text:187 188 while (*format) {189 unsigned int i;190 for (i = 0; format[i] && format[i] != '%'; i++)191 ;192 if (i) {193 ret = _tty_puts(format,i);194 if (ret != i)195 return 1; /* return error */196 format += i;197 }198 if (*format == '%') {199 format++;200 goto printf_arguments;201 }202 }203 204 va_end(ap);205 return 0;206 207 printf_arguments:208 209 {210 int val = va_arg(ap, long);211 char buf[20];212 char* pbuf;213 unsigned int len = 0;214 static const char HexaTab[] = "0123456789ABCDEF";215 unsigned int i;216 217 switch (*format++) {218 case ('c'): /* char conversion */219 len = 1;220 buf[0] = val;221 pbuf = buf;222 break;223 case ('d'): /* decimal signed integer */224 if (val < 0) {225 val = -val;226 ret = _tty_puts("-",1);227 if (ret != 1)228 return 1; /* return error */229 }230 case ('u'): /* decimal unsigned integer */231 for( i=0 ; i<10 ; i++) {232 buf[9-i] = HexaTab[val % 10];233 if (!(val /= 10)) break;234 }235 len = i+1;236 pbuf = &buf[9-i];237 break;238 case ('x'): /* hexadecimal integer */239 ret = _tty_puts("0x",2);240 if (ret != 2)241 return 1; /* return error */242 for( i=0 ; i<8 ; i++) {243 buf[7-i] = HexaTab[val % 16U];244 if (!(val /= 16U)) break;245 }246 len = i+1;247 pbuf = &buf[7-i];248 break;249 case ('s'): /* string */250 {251 char *str = (char*)val;252 while ( str[len] ) len++;253 pbuf = (char*)val;254 }255 break;256 default:257 goto printf_text;258 }259 260 ret = _tty_puts(pbuf, len);261 if (ret != len)262 return 1;263 goto printf_text;264 }265 150 } 266 151 … … 718 603 /////////////////////////////////////////////////////////////////////////// 719 604 // Initialise vobjs 605 // For now only one type is initialised the: PTAB 606 // 720 607 // param: 721 // vobj: the vobj to initialise722 // region_id: the vspace in wich the vobj is located or the global space(-1).608 // vobj: the vobj to initialise 609 // region_id: the vspace in wich the vobj is located or the global space(-1). 723 610 /////////////////////////////////////////////////////////////////////////// 724 void init ialise_ptabs(mapping_vobj_t* vobj, unsigned int region_id)611 void initailise_vobj(mapping_vobj_t* vobj, unsigned int region_id) 725 612 { 726 613 if(vobj->type == PTAB) … … 804 691 // + to computes the length of the current vseg 805 692 // + Align vobjs 806 // + Initialise the ptabs if the vobj correspond693 // + Initialise the vobj 807 694 cur_vaddr = vseg->vbase; 808 695 cur_paddr = vseg->pbase; … … 821 708 cur_vaddr += vobj[vobj_id].length; 822 709 cur_paddr += vobj[vobj_id].length; 823 init ialise_ptabs(&vobj[vobj_id], region_id);710 initailise_vobj(&vobj[vobj_id], region_id); 824 711 } 825 712 -
soft/giet_vm/boot/reset.S
r160 r162 119 119 jal boot_init 120 120 nop 121 j app_start121 j to_kinit 122 122 nop 123 123 … … 130 130 nop 131 131 132 app_start:132 to_kinit: 133 133 /* All processors initialize PTPR / MODE */ 134 134 /* and jump to kernel_init code. */ -
soft/giet_vm/mover/src/mover.cpp
r161 r162 40 40 41 41 42 #define MOVER_DEBUG42 //#define MOVER_DEBUG 43 43 44 44 Mover::Mover( const std::string &filename, -
soft/giet_vm/xml/xml_parser.c
r160 r162 12 12 #include <stdlib.h> 13 13 #include <fcntl.h> 14 #include <sys/types.h> 15 #include <sys/stat.h> 14 16 #include <unistd.h> 15 17 #include <stdio.h>
Note: See TracChangeset
for help on using the changeset viewer.