Absender: Simon Siemens
Datum: Do, 12.05.2011 19:30:21
Hi Timo, dieser Patch enthÃlt ein neues make-Target. Es baut eine statische Bibliothek aus den C-Datei in * ct-Bot (auÃer ct-Bot.c), * mcu, * pc und * ui. Dieser Patch fÃgt nur das make-Target hinzu. Eine entsprechende Konfiguration fÃr die Eclipse-Buildumgebung kommt im nÃchsten Patch. Im Moment wird die Bibliothek nur gebaut, aber noch nicht genutzt. (Man kÃnnte sie ja dazu nutzen, ct-Bot.elf usw. zu erzeugen.) Sie zu nutzen wÃrde nur etwa 3 Zeilen Ãnderung im Makefile erfordern. Ich kann sie gerne nachliefern. Nun aber zuerst zum Weshalb und Wozu. Der ct-Bot-Code bietet eine umfangreiche Infrastruktur fÃr verschiedene Roboterverhalten. Wenn man diese aber nicht nutzen will, ist der Ãbrige Teil dennoch generell einsetzbar. Er bietet einige Hilfskomponenten und die MÃglichkeit, einen Simulator zu nutzen. Wir wollen unsere Studenten damit experimentieren lassen, ohne dass sie die volle ct-Bot-Infrastruktur brauchen, verstehen und einrichten mÃssen. (Es sind komplette ProgrammieranfÃnger.) Deshalb arbeiten wir gerade daran, von der Infrastruktur eine Bibliothek (je eine Archivdatei fÃr die PC- und die MCU-Variante) zu erstellen und fÃr verschiedene Linux-Distributionen (im Moment OpenSUSE und Ubuntu) mit Hilfe des OpenSUSE Build Service zu paketieren. GruÃ, Simon
Index: Makefile =================================================================== --- Makefile (Revision 1786) +++ Makefile (Arbeitskopie) @@ -41,6 +41,9 @@ # Target file name (without extension). TARGET = ct-Bot +# Name of the library that contains the hardware abstraction layer +LIBRARY = libctbot.a + # Target Device, either pc or mcu, usually defined on commandline DEVICE ?= MCU #DEVICE ?= PC @@ -52,7 +55,10 @@ SRCPC = pc/bot-2-sim_pc.c pc/botfs_pc.c pc/botfs-low_pc.c pc/botfs-tools_pc.c pc/cmd-tools_pc.c pc/delay_pc.c pc/display_pc.c pc/eeprom_pc.c pc/ena_pc.c pc/init-low_pc.c pc/ir-rc5_pc.c pc/led_pc.c pc/mini-fat_pc.c pc/mmc-emu_pc.c pc/motor-low_pc.c pc/mouse_pc.c pc/os_thread_pc.c pc/sensor-low_pc.c pc/tcp-server.c pc/tcp.c pc/timer-low_pc.c pc/trace.c -SRCCOM = bot-2-bot.c botfs.c command.c $(TARGET).c fifo.c init.c log.c map.c math_utils.c minilog.c mmc-vm.c motor.c pos_store.c sensor.c timer.c +SRCCOM = bot-2-bot.c botfs.c command.c fifo.c init.c log.c map.c math_utils.c minilog.c mmc-vm.c motor.c pos_store.c sensor.c timer.c + +SRCMAIN = $(TARGET).c + SRCUI = ui/gui.c ui/misc.c ui/rc5.c SRCLOGIC = bot-logic/behaviour_avoid_border.c bot-logic/behaviour_avoid_col.c bot-logic/behaviour_calibrate_pid.c bot-logic/behaviour_calibrate_sharps.c bot-logic/behaviour_cancel_behaviour.c bot-logic/behaviour_catch_pillar.c bot-logic/behaviour_classify_objects.c bot-logic/behaviour_delay.c bot-logic/behaviour_drive_area.c bot-logic/behaviour_drive_chess.c bot-logic/behaviour_drive_distance.c bot-logic/behaviour_drive_square.c bot-logic/behaviour_drive_stack.c bot-logic/behaviour_follow_line_enhanced.c bot-logic/behaviour_follow_line.c bot-logic/behaviour_follow_object.c bot-logic/behaviour_follow_wall.c bot-logic/behaviour_get_utilization.c bot-logic/behaviour_goto_obstacle.c bot-logic/behaviour_goto_pos.c bot-logic/behaviour_goto.c bot-logic/behaviour_gotoxy.c bot-logic/behaviour_hang_on.c bot-logic/behaviour_line_shortest_way.c bot-logic/behaviour_measure_distance.c bot-logic/behaviour_olympic.c bot-logic/behaviour_pathplaning.c bot-logic/behaviour_remotecall.c bot-logic/behaviour_scan.c bot-logic/behaviour_scan_beacons.c bot-logic/behaviour_servo.c bot-logic/behaviour_simple.c bot-logic/behaviour_solve_maze.c bot-logic/behaviour_transport_pillar.c bot-logic/behaviour_turn.c bot-logic/behaviour_ubasic.c bot-logic/bot-logic.c bot-logic/tokenizer.c bot-logic/ubasic_call.c bot-logic/ubasic_cvars.c bot-logic/ubasic_ext_proc.c bot-logic/ubasic.c @@ -65,7 +71,8 @@ #else # SRC = $(TARGET).c $(SRCCOM) $(SRCPC) #endif -SRC =$(SRCCOM) $(SRCUI) $(SRCPC) $(SRCMCU) $(SRCLOGIC) +SRCLIBRARY = $(SRCCOM) $(SRCUI) $(SRCPC) $(SRCMCU) +SRCBEHAVIOUR = $(SRCMAIN) $(SRCLOGIC) # List Assembler source files here. @@ -276,12 +283,14 @@ MSG_COMPILING = Compiling: MSG_ASSEMBLING = Assembling: MSG_CLEANING = Cleaning project: +MSG_CREATING_LIBRARY = Creating library: # Define all object files. -OBJ = $(ASRC:.S=.o) $(SRC:.c=.o) +OBJLIBRARY = $(ASRC:.S=.o) $(SRCLIBRARY:.c=.o) +OBJBEHAVIOUR = $(ASRC:.S=.o) $(SRCBEHAVIOUR:.c=.o) # Define all listing files. LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) @@ -319,6 +328,7 @@ lss: $(TARGET).lss sym: $(TARGET).sym +library: $(LIBRARY) # Eye candy. # AVR Studio 3.x does not check make's exit code but relies on @@ -381,6 +391,11 @@ $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof +$(LIBRARY): $(OBJLIBRARY) + @echo + @echo $(MSG_CREATING_LIBRARY) $@ + $(AR) $(ARFLAGS) $@ $^ + ranlib $@ # Create final output files (.hex, .eep) from ELF output file. %.hex: %.elf @@ -411,10 +426,10 @@ # Link: create ELF output file from object files. .SECONDARY : $(TARGET).elf .PRECIOUS : $(OBJ) -%.elf: $(OBJ) +%.elf: $(OBJBEHAVIOUR) $(OBJLIBRARY) @echo @echo $(MSG_LINKING) $@ - $(CC) --output $@ $(LDFLAGS) $(OBJ) $(MATH_LIB) + $(CC) --output $@ $(LDFLAGS) $^ $(MATH_LIB) # Compile: create object files from C source files. @@ -454,10 +469,14 @@ $(REMOVE) $(TARGET).sym $(REMOVE) $(TARGET).lnk $(REMOVE) $(TARGET).lss - $(REMOVE) $(OBJ) + $(REMOVE) $(LIBRARY) + $(REMOVE) $(OBJBEHAVIOUR) + $(REMOVE) $(OBJLIBRARY) $(REMOVE) $(LST) - $(REMOVE) $(SRC:.c=.s) - $(REMOVE) $(SRC:.c=.d) + $(REMOVE) $(SRCBEHAVIOUR:.c=.s) + $(REMOVE) $(SRCLIBRARY:.c=.s) + $(REMOVE) $(SRCBEHAVIOUR:.c=.d) + $(REMOVE) $(SRCLIBRARY:.c=.d) $(REMOVE) .dep/* Index: Changelog.txt =================================================================== --- Changelog.txt (Revision 1786) +++ Changelog.txt (Arbeitskopie) @@ -1,2 +1,4 @@ CHANGELOG fuer c't-Bot ====================== +2011-05-12 Simon Siemens [simon.siemens@xxxxxxxx]: Neues make-Target library fÃr eine Bibliothek der Infrastrukturkomponenten (Hardwareabstraktion, OS, ...). +