Society of Robots - Robot Forum

Software => Software => Topic started by: shanzhere on July 15, 2011, 01:30:42 AM

Title: Help needed in adpating iRobot code to run with ATmeg16
Post by: shanzhere on July 15, 2011, 01:30:42 AM
Hey people,
i am new to this site..
and i was using the robot tutorial for the $50 bot..
thou i decided to do it wid a slight difference...
making use of an ATmega16..
i intend makin the robot coapable of addaptive mappin and found the iRobot code great for that purpose..
Now i need some help in adapting the code for the ATmega16..
any help wud be welcome..
thanx
regards,
shanil
Title: Re: Help needed in adpating iRobot code to run with ATmeg16
Post by: shanzhere on July 19, 2011, 12:51:55 AM
well i managed to get it to compile all rit and stf...
but the hex file generated is lik 21 or so kb and the atmega16 has 16kb mem...
lso i noticed the same code is used with the atmega168 which lso has 16 kb...
is it possible to upload a 21kb hex file into the atmega 16???
please reply at the earliest
regards,
Shanil
Title: Re: Help needed in adpating iRobot code to run with ATmeg16
Post by: corrado33 on July 19, 2011, 04:01:11 AM
No, you'll have to trim some code out.  Do you have optimization turned on?
Title: Re: Help needed in adpating iRobot code to run with ATmeg16
Post by: voyager2 on July 19, 2011, 06:14:39 AM
Hi Shanzhere,
Welcome to the forum!

[...]
but the hex file generated is lik 21 or so kb and the atmega16 has 16kb mem...
[...]
is it possible to upload a 21kb hex file into the atmega 16???
Often times the hex file is larger on a PC than on the micro; dunno why, it just is,
read your code, optimize optimize optimize!!!
Best bet would be to flash the program, and if you get errors, trim!

 
 Voyager

Title: Re: Help needed in adpating iRobot code to run with ATmeg16
Post by: waltr on July 19, 2011, 06:44:56 AM
The HEX file contains more than just the code that goes into the ATmega. It has addresses and checksums as well as other information than the Programming tools use.
Have you tried to load the ATmega with that Hex file?
What is the code size reported by the compiler? This is what you use to determine if the code will fit.
Title: Re: Help needed in adpating iRobot code to run with ATmeg16
Post by: shanzhere on July 26, 2011, 11:27:49 PM
hey thanx for the advice guys...
i did trim the code to optimise the code size...it did have a lot of over head and after trimming i got the hex file to be small enough to be runnin on my atmega16...so well my $50 bot with addaptive mapping will be up and running soon....
thanx for all the help..