GNU assembler for HC11

Disassembly, Reassembly, Tools and devleopment. Going deep with Hardware and Software.
Post Reply
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

GNU assembler for HC11

Post by antus »

Ive been trying to figure out how to disassemble and reassemble 128kbit bins. Ive got a good disassembly now in GNU Assembler format. I can assemble the code to an elf file.

On linux, do this to get the toolchain (windows after installing cygwin is probably pretty similar, but i cant help with that):

Code: Select all

wget http://ftp.gnu.org/pub/gnu/binutils/binutils-2.19.tar.gz
tar xzvf binutils-2.19.tar.gz 
cd binutils-2.19
./configure --target=m6811-elf --program-prefix=m6811-elf-
make
su -c 'make install'
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: GNU assembler for HC11

Post by antus »

Heres a disassembly for the lower 64k half of the VS BSTK.bin. Kudos to anyone who can get it to assemble and match the lower half of the original BSTK1451.BIN, and post some instructions here. It does appear to assemble with the m6811-elf- toolchain, but all the locations referenced by symbol name come out pointing to 0x0000. Not sure if im missing an assembler or a linker switch, or if its the result of a bug!

Im running:

$ m6811-elf-as --version

GNU assembler (GNU Binutils) 2.19
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `m6811-elf'.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: GNU assembler for HC11

Post by antus »

Close now. assemble with:

Code: Select all

m6811-elf-as BSTKgnu.asm 
create a file, memory.x with:

Code: Select all

MEMORY
{
  page0(rwx) : ORIGIN = 0x0000, LENGTH = 0x03FF
  text(rwx) : ORIGIN = 0x0000, LENGTH = 0x10000
  data(rwx) : ORIGIN = 0x0000, LENGTH = 0x10000
  bss(rwx)  : ORIGIN = 0x0000, LENGTH = 0x10000
  eeprom(r) : ORIGIN = 0x0E00, LENGTH = 0x1FF
}
The linker seems to crash when creating binary files, but creating srec works around it so:

Code: Select all

m6811-elf-ld a.out -m m68hc11elfb --oformat srec -o bstk.srec
m6811-elf-objcopy -I srec bstk.srec -O binary bstk.bin
This gives a pretty correct looking lower half binfile.. so thats it for this part of the project... hopefully some doors are now open, and i'll crawl back in to my cave and keep delco hacking :mrgreen: :thumbup:

BSTKlow.bin is the lower original half of the file, bstk.bin was created from the above :punk:

Code: Select all

[ant@media vs]$ md5sum bstk.bin BSTKlow.bin 
2e39bffede15f1a4db2f5b1f3956e3eb  bstk.bin
2e39bffede15f1a4db2f5b1f3956e3eb  BSTKlow.bin
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
Holden202T
Posts: 10311
Joined: Sat Feb 28, 2009 9:05 pm
Location: Tenambit, NSW
Contact:

Re: GNU assembler for HC11

Post by Holden202T »

you make good progress when you talk to yourself :D
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: GNU assembler for HC11

Post by antus »

Yep, them voices in my head must be good for something :think:
So how do you deal with 128k bins? thats how! the door is open.... watch this space... you saw it here on delco hacking first :afro:
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
VL400
Posts: 4991
Joined: Sun Mar 01, 2009 2:54 pm
cars: VL Calais and Toyota Landcruiser. Plus some toys :)
Location: Perth, WA
Contact:

Re: GNU assembler for HC11

Post by VL400 »

Nicely done antus, this should get the 128k bin development started.
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: GNU assembler for HC11

Post by antus »

Code: Select all

[ant@media bstk]$ make
m6811-elf-as  BSTKhigh.asm -o BSTKhigh.o
m6811-elf-ld -m m68hc11elfb --oformat srec BSTKhigh.o -o BSTKhigh.srec
m6811-elf-ld: warning: cannot find entry symbol _start; defaulting to 00000000
m6811-elf-objcopy -I srec BSTKhigh.srec -O binary BSTKhigh.bin
m6811-elf-as  BSTKlow.asm -o BSTKlow.o
m6811-elf-ld -m m68hc11elfb --oformat srec BSTKlow.o -o BSTKlow.srec
m6811-elf-objcopy -I srec BSTKlow.srec -O binary BSTKlow.bin
cat BSTKlow.bin BSTKhigh.bin > BSTK.bin

[ant@media bstk]$ ls -lh *.bin
-rw-rw-r-- 1 ant ant 128K 2009-08-29 11:37 BSTK.bin
-rw-rw-r-- 1 ant ant  64K 2009-08-29 11:37 BSTKhigh.bin
-rw-rw-r-- 1 ant ant  64K 2009-08-29 11:37 BSTKlow.bin
:thumbup:
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
delcowizzid
Posts: 5493
Joined: Sat Feb 28, 2009 8:38 pm
Location: Wellington NZ
Contact:

Re: GNU assembler for HC11

Post by delcowizzid »

i go away for a week and you bust out the brilliance nice work mate
If Its Got Gas Or Ass Count Me In.if it cant be fixed with a hammer you have an electrical problem
sabercatpuck
Posts: 67
Joined: Thu Jan 14, 2010 1:03 am
cars: 1999 Saturn SL1
2003 Monte Carlo

Re: GNU assembler for HC11

Post by sabercatpuck »

I know when I dissasembled the code on my Saturn 128k bin I had to do it in 4 parts. treating each quadrent of the the bin file seperatly. Had alot of jumps outside of code, but got a clean dissasembly out of it. I know on mine there are several routines arround $5666 that the system loads the x register with the jump address, calls the appropriate routine to change a couple pins on port g of the 68hc11F1 and that in turn changes the addressing to the chip's upper memory half banking in 3 different halves.
Post Reply