chiark / gitweb /
new building arrangements for a better morse
authorian <ian>
Sun, 20 Nov 2005 01:17:47 +0000 (01:17 +0000)
committerian <ian>
Sun, 20 Nov 2005 01:17:47 +0000 (01:17 +0000)
12 files changed:
Makefile
cebpic/.cvsignore
cebpic/manypics.make
cebpic/morse-auto.asm-gen
detpic/.cvsignore
detpic/Makefile
detpic/i2clib.asm
detpic/i2clib.inc
detpic/morse-auto.messages
iwjpictest/.cvsignore
iwjpictest/Makefile
pic.make

index 8b1db90e19d7a303efcebcae2a43a9b3f4a28a1b..52b7afe468e675b49fb259dce3397989ce78265f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,11 @@ all:           picprogs hostprogs
 PICPROGS_DIRS= iwjpictest cebpic detpic
 HOSTPROGS_DIRS=        layout hostside
 
-picprogs:
+pic:
                set -e; for f in $(PICPROGS_DIRS); do $(MAKE) -C $$f; done
 
+pic_%:
+               set -e; for f in $(PICPROGS_DIRS); do $(MAKE) -C $$f $*; done
+
 hostprogs:
                set -e; for f in $(HOSTPROGS_DIRS); do $(MAKE) -C $$f; done
index 28b0f2296c693432736f6b79d91c705ba34f5a0c..c0c7dd7f62f9386999f4e01777b4e462856c0fab 100644 (file)
@@ -1,6 +1,7 @@
 *.hex
 *.cod
 *.lst
+*.map
 idlocs*.asm
 gpsim.log
 routines.lib
index c9d729a30e77b03fd545218ad47c60c621c98e6a..0fe7178540bdc79f4b16f2e59e4f2baeb3c3e60f 100644 (file)
@@ -1,17 +1,20 @@
 
-TARGETS=       $(foreach i, $(PICNOS), perpic$i.hex)
-
 include ../common.make
 include ../pic.make
 
 perpic%.hex:   config.o idlocs%.o
                $(LINK)
 
-morse-auto.inc morse-auto.asm: \
- morse-auto.%: $(CEBPIC)morse-auto.asm-gen morse-auto.messages
-               ./$^ $* $o
+morse-auto.inc:        $(CEBPIC)morse-auto.asm-gen morse-auto.messages
+               ./$^ inc $o
+
+%-automorse.asm: $(CEBPIC)morse-auto.asm-gen morse-auto.messages %-bare.map
+               ./$^ asm $o
+
+%-bare.map:    %.o $(LIBS)
+               gplink -m -o $*-bare.hex $^
 
-%-entire0.hex: %.o config.o idlocs0.o $(LIBS)
+%-entire0.hex: %.o config.o idlocs0.o $(LIBS) $(DEFLIBS)
                $(LINK)
 
 idlocs%.asm:   $(CEBPIC)make-idlocs
@@ -21,6 +24,6 @@ ours-pindata.asm: ../layout/ours-pindata.asm
                cp $< $@
 
 manypic-clean: pic-clean
-               rm -f idlocs*.asm
+               rm -f idlocs*.asm *.map *-automorse.*
 
-.PRECIOUS:     idlocs%.asm
+.PRECIOUS:     idlocs%.asm %-bare.map %-automorse.asm
index 07ae2d7fee3a9feaa0cdb6be40a8a22f3ad3826c..e30b21e10ab2bdeb63d1adfc2195881af6d0a1ea 100755 (executable)
 #
 # morse_messages_start and morse_messages_end should be defined in
 # morse-defs.inc, and should also be 4-byte aligned.  morse-defs.inc
-# and morse-defs.fin should arrange to define any symbolic addresses
-# referred to in morse-auto.messages, by saying `extern' (in .fin) or
-# including the pXXXX.inc (in .inc).
+# should also arrange to define any symbolic addresse referred to
+# in morse-auto.messages, eg by including the pXXXX.inc.
 #
 # morse-auto.asm contains the actual source and morse-auto.inc
 # contains `extern' references for the labels morse_XY.
 
+use IO::File;
 use IO::Handle;
 
-sub badusage () { die "usage: morse-auto.asm-gen <input>... asm|inc\n"; }
+sub badusage () {
+    die ("usages:\n".
+        " morse-auto.asm-gen <input>... asm\n".
+        " morse-auto.asm-gen <input>... [<file>.map] inc\n");
+}
 
 @ARGV or badusage();
 $which= pop @ARGV;
@@ -50,6 +54,28 @@ while (<DATA>) {
 
 sub oops ($) { die "morse-auto.asm-gen: $ARGV:$.: $_[0]\n"; }
 
+$mapfile= $ARGV[$#ARGV];
+
+if ($mapfile =~ m/\.map$/) {
+    pop @ARGV;
+    $maph= new IO::File "$mapfile", 'r' or die "$0: $mapfile: $!\n";
+    while (<$maph>) {
+       next unless m/^\s+Symbols\s+$/ .. !/\S/;
+       next unless m/\S/;
+       next if m/^\s+Symbols\s+$/;
+       next if m/^\s+Name\s+Address\s+Location\s+Storage\s+File\s*$/;
+       next if m/^(?:\s+\-\-+){5}\s*$/;
+       m/^\s*([0-9a-zA-Z_]+)\s+(0+|0x[0-9a-f]+)\s+(program|data)\s+(static|extern)\s+(\S+)\s*$/
+           or die "$0: $mapfile:$.: cannot parse ?!\n";
+       ($sym,$val,$progdata,$staticext,$filename) = ($1,$2,$3,$4,$5);
+       next if $progdata ne 'data';
+       $filename =~ s/\.asm$//;
+       $sym= "$filename:$sym" if $staticext eq 'static';
+       $symval{$sym}= $val;
+    }
+    die "$0: $mapfile: $!\n" if $maph->error;
+}
+
 $"=',';
 
 print <<'END' or die $!
@@ -69,6 +95,7 @@ END
     if $which eq 'asm';
 
 $bytes= 0;
+$.= 0;
 
 while (<>) {
     chomp;
@@ -95,10 +122,12 @@ while (<>) {
     $morse_bytes= scalar(@data);
 
     unshift @data, sprintf "0x%x%x", scalar(@addrs), $morse_bytes;
-#    push @data, @addrs;
     push @data, map {
-       "$_";
-#      $_.'&0xff';
+       s/^\:/ $filename.':' /e;
+       $filename= $1 if m/^(.+)\:/;
+       (exists $symval{$_} ? $symval{$_} :
+        "$_ - (0xf00 * !(($_ & 0xf00)^0xf00))");
+       
     } @addrs;
 
     push @data, ('0') x (3 - (scalar(@data) + 3) % 4);
@@ -119,7 +148,6 @@ print <<'END' or die $!
         error "too much morse - extends beyond morse_messages_end"
        endif
 
-       include morse-auto.fin
        end
 END
     if $which eq 'asm';
index 51de301c9ff1f28c43fcd16c0a32592255abc798..349455e894106f706c677b96785a2b967ba8896e 100644 (file)
@@ -1,6 +1,8 @@
 *.hex
 *.cod
 *.lst
+*.map
+*-automorse.asm
 idlocs*.asm
 gpsim.log
 morse-auto.asm
index 4ea37a7f1ad1cd151f480f7a5438efa30d70f7f8..a0bf895d9e87dc6961e0468c0934b105a8704f63 100644 (file)
@@ -1,11 +1,12 @@
 PROGRAMS=      test-sofar
 INCLUDES=      common.inc final.inc morse-auto.inc \
                ../iwjpictest/insn-aliases.inc
-LIBS=          vectors.o panic.o routines-led.o variables.o \
-                i2clib.o morse-auto.o
+LIBS=          vectors.o panic.o routines-led.o variables.o i2clib.o
+DEFLIBS=       test-sofar-automorse.o
 PICNOS=                0 1 2
 CEBPIC=                ../cebpic/
-TARGETS=       $(foreach i, $(PICNOS), perpic$i.hex)
+TARGETS=       $(addsuffix -bare.map, $(PROGRAMS)) \
+               $(foreach i, $(PICNOS), perpic$i.hex)           
 
 include                $(CEBPIC)manypics.make
 
index 49e8b37c47e610cde714f249991fa2af64d17717..d90803f1f9fa9cb60228cad0126723e952140a5b 100644 (file)
 ;
 ;              ;----------
 ;              m_event_spong
-;                              bt_f_if0 i2c_st, st_something
+;                              bt_f_if0 st, st_something
 ;                              bra     m_event_bad
 ;              ;...
 ;
 ;              m_event_several_including_spong
-;                              bs_f    i2c_st, st_sponging
+;                              bs_f    st, st_sponging
 ;                              bra     metasyntacticing
 ;
 ;              ;----------
 
                udata_acs
 
-i2c_sspstat            res     1
-i2c_sspcon1            res     1
-i2c_sspcon2            res     1       ; master only
-i2c_slave              res     1       ; master only
+sspstat                res     1
+sspcon1                res     1
+sspcon2                res     1       ; master only
+slave          res     1       ; master only
 
-i2c_st                 res     1
+st             res     1
 
-; i2c_st is a bitmask, bit set in visible states:
+; st is a bitmask, bit set in visible states:
                  ;    master                          slave
 st_starting    equ 7 ; Writing-Setup?,Reading-Busy?
 st_addressing  equ 6 ; Writing-Setup?,Reading-Busy?
@@ -102,41 +102,41 @@ i2cm_interrupt
                return
                ; We have an interrupt:
 
-               mov_ff  SSPSTAT, i2c_sspstat
-               mov_ff  SSPCON1, i2c_sspcon1
-               mov_ff  SSPCON2, i2c_sspcon2
+               mov_ff  SSPSTAT, sspstat
+               mov_ff  SSPCON1, sspcon1
+               mov_ff  SSPCON2, sspcon2
 
-               bt_f_if1 i2c_sspcon1, WCOL
+               bt_f_if1 sspcon1, WCOL
                bra_z   m_event_bad
-               bt_f_if1 i2c_sspcon1, SSPOV
+               bt_f_if1 sspcon1, SSPOV
                bra_z   m_event_bad
 
                ; No ?  Well, then the I2C should be idle now:
-               mov_fw  i2c_sspcon2
+               mov_fw  sspcon2
                and_lw  ~0x60 ; ACKSTAT,ACKDT
                bra_nz  m_event_bad
                ; OK...
 
-               bt_f_if1 i2c_sspstat, R_W
+               bt_f_if1 sspstat, R_W
                bra_nz  m_event_bad
 
-               bt_f_if1 i2c_st, st_stopping
+               bt_f_if1 st, st_stopping
                bra     m_event_done_stopping
 
-               bt_f_if1 i2c_st, st_starting
+               bt_f_if1 st, st_starting
                bra     m_event_done_starting
                ; not just done SEN
 
-               bt_f_if1 i2c_st, st_addressing
+               bt_f_if1 st, st_addressing
                bra     m_event_done_addressing
 
-               bt_f_if1 i2c_st, st_writing
+               bt_f_if1 st, st_writing
                bra     m_event_done_writing
 
-               bt_f_if1 i2c_st, st_acking
+               bt_f_if1 st, st_acking
                bra     m_event_done_acking
 
-               bt_f_if1 i2c_st, st_reading
+               bt_f_if1 st, st_reading
                bra     m_event_done_reading
 
 m_event_bad
@@ -147,40 +147,40 @@ m_event_bad
 
 ;----------
 m_start
-;      i2c_st                  checked for busyness    correct
+;      st                      checked for busyness    correct
 ;      st_reading/writing      set                     unchanged
 ;      st_starting             clear                   set
 ;      W                       slave number            any
-;      i2c_slave               any                     slave_number
+;      slave                   any                     slave_number
 ; expects to return directly to main program (caller)
-               mov_wf  i2c_slave
+               mov_wf  slave
                and_lw  31
                bra_nz  m_improper_slave
-               bs_f    i2c_st, st_starting
+               bs_f    st, st_starting
                bs_f    SSPCON2, SEN
                return
 
 ;----------
 m_event_done_starting
-               mov_fw  i2c_slave
+               mov_fw  slave
                rcall   slave2addr
 
-               bt_f_if1 i2c_st, st_reading
+               bt_f_if1 st, st_reading
                bs_w    0       ; address bottom bit means read
 
                mov_wf  SSPBUF
-               bc_f    i2c_st, st_starting
-               bs_f    i2c_st, st_addressing
+               bc_f    st, st_starting
+               bs_f    st, st_addressing
                return
 
 ;----------
 m_event_done_addressing
-               bt_f_if1 i2c_sspcon2, ACKSTAT
+               bt_f_if1 sspcon2, ACKSTAT
                bra     m_bad_address_ack
                ; OK, we got ack.
 
-               bc_f    i2c_st, st_addressing
-               bt_f_if1 i2c_st, st_reading
+               bc_f    st, st_addressing
+               bt_f_if1 st, st_reading
                bra     m_event_done_addressing_read
                bra     m_event_done_addressing_write
 
@@ -189,13 +189,13 @@ m_stop
 ;      st_stopping                     clear           set
 ;      st_reading/acking/writing       any             unchanged
 ; expects to return directly to main program or to end interrupt handler
-               bs_f    i2c_st, st_stopping
+               bs_f    st, st_stopping
                bs_f    SSPCON2, PEN
                return
 
 ;----------
 m_event_done_stopping
-               clr_f   i2c_st
+               clr_f   st
                goto    i2cmu_done
 
 ;----------
@@ -204,7 +204,7 @@ m_bad_address_ack
 
 ;----------
 m_improper_slave
-;      i2c_slave               slave number
+;      slave                   slave number
                panic   morse_SN
 
 ;========================================
@@ -215,19 +215,19 @@ i2cm_write_start
 ;                              At call         On return
 ;   State                      Idle            Writing-Setup
 ;   W                          slave number    any
-               tst_f_ifnz i2c_st
+               tst_f_ifnz st
                bra     m_improper_write_start
 
-               bs_f    i2c_st, st_writing
+               bs_f    st, st_writing
                bra     m_start
 
 ;----------
 m_event_done_writing
                ; Did slave ack our byte ?  It had better have done !
-               bt_f_if1 i2c_sspcon2, ACKSTAT
+               bt_f_if1 sspcon2, ACKSTAT
                bra     m_event_bad
 
-               bs_f    i2c_st, st_subsequent
+               bs_f    st, st_subsequent
 ;...
 
 m_event_done_addressing_write
@@ -242,7 +242,7 @@ m_event_done_addressing_write
 
 ;----------
 m_event_write_mustfinish
-               bt_f_if0 i2c_st, st_subsequent
+               bt_f_if0 st, st_subsequent
                bra     m_improper_write_finish
 
                bra     m_stop
@@ -263,10 +263,10 @@ i2cm_read_start
 ;                              At call         On return
 ;      State                   Idle            Reading-Busy
 ;      W                       slave number    any
-               tst_f_ifnz i2c_st
+               tst_f_ifnz st
                bra     m_improper_read_start
 
-               bs_f    i2c_st, st_reading
+               bs_f    st, st_reading
                bra     m_start
 
 ;----------
@@ -279,18 +279,18 @@ m_event_done_acking_readmore
 
 ;----------
 m_event_done_reading
-               bt_f_if0 i2c_sspstat, BF
+               bt_f_if0 sspstat, BF
                bra     m_event_bad
 
                mov_fw  SSPBUF
 
-               bs_f    i2c_st, st_awaiting
+               bs_f    st, st_awaiting
                goto    i2cmu_read_got_byte
 
 ;----------
 i2cm_read_another
 ;   State                      Reading-Wait    Reading-Busy
-               bt_f_if0 i2c_st, st_awaiting
+               bt_f_if0 st, st_awaiting
                bra     m_improper_read_another
                ; OK, we're fine to read another:
 ;...
@@ -300,8 +300,8 @@ m_read_ack
 ;      st_awaiting             still set               cleared
 ;      st_acking               clear                   set
 ; expects to return directly to main program or to end interrupt handler
-               bc_f    i2c_st, st_awaiting
-               bs_f    i2c_st, st_acking
+               bc_f    st, st_awaiting
+               bs_f    st, st_acking
                bc_f    SSPCON2, ACKDT ; ACKDT=0 means to acknowledge
                bs_f    SSPCON2, ACKEN
                return
@@ -309,9 +309,9 @@ m_read_ack
 ;----------
 i2cm_read_done
 ;   State                      Reading-Wait    Stopping
-               bc_f    i2c_st, st_reading
+               bc_f    st, st_reading
                
-               bt_f_if0 i2c_st, st_awaiting
+               bt_f_if0 st, st_awaiting
                bra     m_improper_read_done
                ; OK:
 
@@ -319,9 +319,9 @@ i2cm_read_done
 
 ;----------
 m_event_done_acking
-               bc_f    i2c_st, st_acking
+               bc_f    st, st_acking
 
-               bt_f_if1 i2c_st, st_reading
+               bt_f_if1 st, st_reading
                bra     m_event_done_acking_readmore
 
                bra     m_stop
@@ -346,7 +346,7 @@ i2cs_init
 ;      W               slave number            undefined
                rcall   slave2addr
                mov_wf  SSPADD
-               clr_f   i2c_st
+               clr_f   st
                mov_lw  0x16 ; !SSPEN, CKP(release), I2C 7-bit slave no-SP-int
                mov_wf  SSPCON1
                mov_lw  0x01 ; !GCEN, SEN
@@ -364,9 +364,9 @@ init_enable
 ;      SSPIP                   any                     configured correctly
 ;      GIEL                    0 (disabled)            0 (disabled)
 ;      ssp* shadows            any                     all bits set
-               set_f   i2c_sspstat
-               set_f   i2c_sspcon1
-               set_f   i2c_sspcon2
+               set_f   sspstat
+               set_f   sspcon1
+               set_f   sspcon2
                bs_f    TRISB, 0
                bs_f    TRISB, 1
                bc_f    IPR1, SSPIP
@@ -387,7 +387,7 @@ init_enable
 ; Some macros:
 
 chkvals_start_sspstat macro
-               mov_fw  i2c_sspstat
+               mov_fw  sspstat
                endm
 
 chkval macro lastval, value, label
@@ -407,22 +407,22 @@ i2cs_interrupt
                return
                ; We have an interrupt:
 
-               bt_f_if1 i2c_sspcon1, WCOL
+               bt_f_if1 sspcon1, WCOL
                bra_z   s_event_bad
-               bt_f_if1 i2c_sspcon1, SSPOV
+               bt_f_if1 sspcon1, SSPOV
                bra_z   s_event_bad
 
 ; Firstly, clear the interrupt flag so that if something else happens
 ; while we faff, the interrupt will be regenerated:
                bc_f    PIR1, SSPIF
 
-               mov_ff  SSPSTAT, i2c_sspstat
-               mov_ff  SSPCON1, i2c_sspcon1
+               mov_ff  SSPSTAT, sspstat
+               mov_ff  SSPCON1, sspcon1
 
-               bt_f_if0 i2c_st, st_reading
+               bt_f_if0 st, st_reading
                bra     s_event_reading
 
-               bt_f_if0 i2c_st, st_writing
+               bt_f_if0 st, st_writing
                bra     s_event_writing
 
 s_event_idle
@@ -436,7 +436,7 @@ s_event_bad
 
 ;----------
 s_event_idle_addrrecvread
-               bs_f    i2c_st, st_reading
+               bs_f    st, st_reading
                call    i2csu_read_begin
                bra     s_events_reading_datasend
 
@@ -446,7 +446,7 @@ s_event_reading
                chkval  0, 0xac, s_event_reading_datasent ; D,!P, S,R,!BF
 
                ; Whatever is happening, we're done reading now !
-               clr_f   i2c_st
+               clr_f   st
                call    i2csu_read_done
 
                chkvals_start_sspstat
@@ -471,7 +471,7 @@ s_event_reading_datanack
 ;----------
 s_event_idle_addrrecvwrite
                bs_f    SSPCON1, 3 ; we'll need the Stop interrupt
-               bs_f    i2c_st, st_writing
+               bs_f    st, st_writing
                ; well, this is all fine so far, so do carry on:
 
 s_write_slurpbyte
@@ -487,7 +487,7 @@ s_event_writing
                chkval  0, 0xa9, s_event_writing_datarecv ; D,!P, S,W,BF
 
                ; Well, we're done writing now in any case
-               clr_f   i2c_st
+               clr_f   st
                bc_f    SSPCON1, 3 ; no Start and Stop interrupts any more
                call    i2csu_write_done
 
@@ -501,7 +501,7 @@ s_event_writing
                chkvals_addrrecv 0
 
                ; Then random junk:
-               mov_fw  i2c_sspstat
+               mov_fw  sspstat
                and_lw  0xc7 ; ?D_A, ?P; ?S
                xor_lw  0x80 ; SMP, !CKE, !R_W, !UA, !BF
                bt_f_if1 STATUS, Z
@@ -514,11 +514,11 @@ s_event_writing
 s_event_writing_datarecv
                rcall   s_write_slurpbyte
 
-               bt_f_if1 i2c_st, st_subsequent
+               bt_f_if1 st, st_subsequent
                goto    i2csu_write_another
                ; not subsequent (yet):
 
-               bs_f    i2c_st, st_subsequent
+               bs_f    st, st_subsequent
                goto    i2csu_write_begin
 
 ;======================================================================
index a8d2b1d3fa9c587792cbe35eba7d79ffe2a38c7b..d96cbd655c486cc720210514bfa59f2f68e1160a 100644 (file)
 ;
 ;              Beforehand      At call                 On return
 ;   State      Transmitting    Idle
-
-;======================================================================
-; INTERNAL VARIABLES
-;
-; these are `extern'd only so that the morse machinery can display them
- extern i2c_sspstat
- extern i2c_sspcon1
- extern i2c_sspcon2
- extern i2c_slave
- extern i2c_st
index f8fd2aae9ee02a6e798a60f0efebb4ccd69cfd9c..ed079bac8fa832da51b2cb999d0384c86ae4f1bf 100644 (file)
@@ -31,12 +31,12 @@ TI5                         ; for iwj
 X      ch                      ; bad character received from host
 
 # Messages for i2clib, S*
-SM     i2c_st,i2c_sspstat,i2c_sspcon1,i2c_sspcon2 ; m.,i., ctrlr bad state
-SS     i2c_st,i2c_sspstat,i2c_sspcon1  ; slave, intr, controller bad state
-SK     i2c_slave                       ; m. couldn't address slave (no ack)
-SN     i2c_slave                       ; improper slave number
-SW     i2c_st                          ; improper i2cm_write_start
-SF     i2c_st                          ; improper i2cmu_write_next_byte Z
-SR     i2c_st                          ; improper i2cm_read_start
-SA     i2c_st                          ; improper i2cm_read_another
-SD     i2c_st                          ; improper i2cm_read_done
+SM     i2clib:st,:sspstat,:sspcon1,:sspcon2 ; m.,i., ctrlr bad state
+SS     i2clib:st,:sspstat,:sspcon1     ; slave, intr, controller bad state
+SK     i2clib:slave                    ; m. couldn't address slave (no ack)
+SN     i2clib:slave                    ; improper slave number
+SW     i2clib:st                       ; improper i2cm_write_start
+SF     i2clib:st                       ; improper i2cmu_write_next_byte Z
+SR     i2clib:st                       ; improper i2cm_read_start
+SA     i2clib:st                       ; improper i2cm_read_another
+SD     i2clib:st                       ; improper i2cm_read_done
index 9ddea0c7884b375015a837e587ca538feb7246ec..9b1501a3d8a190947c11ac9f97c665ec7f2a852e 100644 (file)
@@ -1,7 +1,7 @@
 *.hex
 *.cod
 *.lst
+*.map
 insn-*.ps
 insn-*.txt
 insn-aliases.inc
-*.tmp
index 959afef3922fca977683050bc4502265a2c66125..696a170ec721cffb017e9ce5f761334fac0be35c 100644 (file)
@@ -6,6 +6,8 @@ INSN_TARGETS=   insn-aliases.inc \
 
 PROGRAMS=      flasher copybits serialloop harness
 
+INCLUDES=      insn-aliases.inc  onecopybit.inc  test.inc
+
 include ../common.make
 include ../pic.make
 
index 974b8437bd4f89c5fa12ad4b8a38f64f5adb5593..8856d937973ef89ba760cc82898d70b49e611818 100644 (file)
--- a/pic.make
+++ b/pic.make
@@ -18,13 +18,13 @@ PROGRAM_HEXES=      $(addsuffix .hex, $(PROGRAMS)) \
                $(addsuffix -withcfg.hex, $(PROGRAMS))
 
 all:           $(TARGETS) $(PROGRAM_HEXES)
-LINK=          gplink -o $@ $^
+LINK=          gplink -m -o $@ $^
 ASSEMBLE=      gpasm -p 18f458
 
 %-withcfg.hex: %.o config.o $(LIBS)
                $(LINK)
 
-%.hex:         %.o $(LIBS)
+%.hex:         %.o $(LIBS) $(DEFLIBS)
                $(LINK)
 
 %.o:           %.asm $(INCLUDES)