brentru / 32to328ptranslator

Extendable shell script to translate ATMEGA32 code to ATMEGA328P code
GNU General Public License v3.0
0 stars 0 forks source link

traslator does not appy bit changes #1

Open bveina opened 8 years ago

bveina commented 8 years ago

while this does allow programs to compile successfully it does not assist in the translation of bits inside of registers. for example

ldi R16,0x0D out TCCR0,R16

will translate to ldi R16,0x0D out TCCR0A,R16

unfortunately this wont work, for several reasons.

the above code would be better written as

LDI R16, (1<<WGM01) | (5 << CS00) out TCCR0, R16

but in the 328p architecture WGM01 is not in TCCR0A it is in TCCR0B.

a fully functional converter or a student who should be doing the ECE263 HW, would know this and split the command into two load statements LDI R16, (5<<CS00) LDI R17, (1<<WGM01)

Thanks for looking into this, Professor Viall

brentru commented 8 years ago

It seems there is too much to account for to make something that works at all, especially seeing that certain timers (WGM01) aren't contained within registers.

bveina commented 8 years ago

perhaps preproccessing the m328pdef.inc and m32def.inc file would provide better insight into what "bits" go where.