Friday, May 8, 2020

Combined file seems to work on Mega

Wanted system where big arduino program that talks to CDP1802 can be surrounded by 1802 code that can be fed, slowly, into real 1802. Had problems feeding arduino program eg CDP1802e93.hex that talks to 1802 and the 1802 asm program eg tackOn0.hex both into avrdude burning. Tried various ways as it seemed to work ok, at least for blink.hex type programs on arduino nano.
Finally wrote a c program that takes two hex files and combines them into one combined hex file and then that gets burned into arduino mega. Seems to work.

C program https://pastebin.com/w6y0RjyC C:\TinyC\MyFiles9May20\combine6.c
Mega program: https://pastebin.com/mxUWzfzD  C:\Users\Dell\Documents\Arduino\PB_SketchApril12\CDP1802e93\CDP1802e93.ino

1802 program: https://pastebin.com/JewvwYKZ  C:\TinyC\MyFiles9May20\tackOn0.asm

The avrdude line that burned in the combinedFilo.hex was:

Dell@DESKTOP-FGA8Q4U C:\TinyC\MyFiles9May20
$ \tinyc\avrdude -C \tinyc\avrdude.conf -v -patmega2560 -cwiring -PCOM14 -b115200 -D -Uflash:w:combinedFile0.bin:r

C program invoked like this:
Dell@DESKTOP-FGA8Q4U C:\TinyC\MyFiles9May20
$ combine6.exe CDP1802e93.ino.bin tackOn0.bin

Note it was the bin files that get combined.

Hex files were changed to bin like this:
Dell@DESKTOP-FGA8Q4U C:\TinyC\MyFiles9May20
$ ..\hex2bin.exe CDP1802e93.ino.hex

Picture of some of the above:


Added this few days later. Look at this Bray++ logfile:
Terminal log file
Date: 12/05/2020 - 11:20:51 AM
-----------------------------------------------
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]
[[[Adr1 4000 : ldi 01]
[[Adr1 4002 : phi 7]
[[Adr1 4003 : lbr 0c]
[[[Adr1 000c : nop ]
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]
[[[Adr1 4000 : ldi 01]
[[Adr1 4002 : phi 7]
[[Adr1 4003 : lbr 0c]
[[[Adr1 000c : nop ]
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]
[[[Adr1 4000 : ldi 01]
[[Adr1 4002 : phi 7]
[[Adr1 4003 : lbr 0c]
[[[Adr1 000c : nop ]
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]

-----------------------------------------------
Date: 12/05/2020 - 11:21:19 AM
End log file

There is a jump from low memory, around, $000e, to high memory $4000 then back again.
This is the tackon file that's split into two parts. One part goes into vRAM[] and the high part is birned up in $4000 by invoking avrdude the combined file with the normal arduino part CDP1802e93.hex with tackOn0.hex.
When the mega starts up it runs a default little loop of 1802.asm commands that start off in vRAM[] declaration. To get it to use above code you press M2 in terminal that asks for a block of 1802 bytes. Chose low1802.bin that gets sliced off bottom of tackOn0.bin automatically by combine6.exe. Once this low little program gets installed it does a reset and then joins up with rest of tackOn but jumping up to $4000 and back down again. We do this to jump over arduino code.

No comments:

Post a Comment

Pi Pico and other Boards

 Got a new Pi Pico and it looks very promising. Want to use Oled display with it.