Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Simplest Code (http://www.chiefdelphi.com/forums/showthread.php?t=31055)

cibressus53 02-11-2004 16:25

Simplest Code
 
What is the simplest code we can upload to the robot? I'm quite pressed for memory space. i can't get both the default code and cordic math libary on their

Raven_Writer 02-11-2004 17:39

Re: Simplest Code
 
I believe the simplest code you can download to the robot and have it do something is the default code.

Max Lobovsky 02-11-2004 17:50

Re: Simplest Code
 
What does "the simplest code" mean? If you just want some joysticks and buttons directly mapped to pwms/relays and don't have any autonomous code, there is a significant amount you can remove from the default code. There are several functions you can remove from user_routines.c/h. Removing printf_lib.c/h and any calls to it would be another very significant space saver. There is probably more in other files, look for yourself.

cibressus53 02-11-2004 18:30

Re: Simplest Code
 
well, after adding the cordic libary to the base code, it sweels to 48kb.

Greg Ross 02-11-2004 20:18

Re: Simplest Code
 
Can someone speak up who has actually used CORDIC on the IFI robot controller?

My thought is that the CORDIC implementation you're using is no good for our application. I'm wondering if the one you're using uses floating point math. If it does, that would swell the code due to the fact that the math library would have to emulate the floating point operations in software.

Bharat Nain 02-11-2004 20:31

Re: Simplest Code
 
Quote:

Originally Posted by cibressus53
well, after adding the cordic libary to the base code, it sweels to 48kb.

Why do you want to add the CORDIC library to your base code anyways?

Alan Anderson 02-11-2004 21:52

Re: Simplest Code
 
Quote:

Originally Posted by gwross
Can someone speak up who has actually used CORDIC on the IFI robot controller?

I did some experimentation with it early on, before we gave up on our optical carpet tracking scheme.
Quote:

My thought is that the CORDIC implementation you're using is no good for our application. I'm wondering if the one you're using uses floating point math. If it does, that would swell the code due to the fact that the math library would have to emulate the floating point operations in software.
CORDIC was devised specifically to avoid floating point operations. It uses addition, subtraction, and bitwise shifts. Doing those with floating point would be, um, pointless.

Pat Fairbank 02-11-2004 22:39

Re: Simplest Code
 
After some experimentation, it appears that the size of the hex file does not directly correspond to the amount of code that is actually uploaded to the robot controller. The hex file containing the default code has a size of 25 KB, while the hex file with the CORDIC library included (I believe this is the library in question) has a size of 48 KB. Even though this hex file is larger than the PIC's 32 KB flash memory, it still uploads and executes on my RC without any problem.

So it seems therefore the size of the hex file containing the code is not an accurate measure of how much flash space the code will take up on the RC.

cibressus53, I think your problem lies somewhere else than in the size of your code.

Greg Ross 02-11-2004 23:22

Re: Simplest Code
 
Quote:

Originally Posted by Pat Fairbank
...the hex file with the CORDIC library included... has a size of 48 KB. Even though this hex file is larger than the PIC's 32 KB flash memory, it still uploads and executes on my RC without any problem.

So it seems therefore the size of the hex file containing the code is not an accurate measure of how much flash space the code will take up on the RC.

Pat,

In the most general case, a hex file will be more than twice as big as the memory image it loads. This is because each byte of the memory image gets represented by two ascii characters in the hex file. And then there is the overhead of having to store address information, CRC/checksum information, and who knows what else.

cibressus53 05-11-2004 09:28

Re: Simplest Code
 
I had to completly remove the print_lib to get it down to a small enoguh size (35kb). does anyone know the real max size for the hex file?

Mark McLeod 05-11-2004 11:46

Re: Simplest Code
 
Quote:

Originally Posted by cibressus53
I had to completly remove the print_lib to get it down to a small enoguh size (35kb). does anyone know the real max size for the hex file?

You can't easily judge by the .hex file size. I can create a .hex file that's 85kb and it fits on the RC just fine.

You know what it does look like though is an IFI_Loader version problem. The original IFI_Loader had a bug that only loaded half the available RC program memory. Check your IFI_Loader version. It should be 1.0.7.

You should use the .map file MPLAB can generate for you to see how much memory your program requires. It tells you exactly how much space your program uses, e.g.,

Code:


Program Memory Usage

Start                End
--------- ---------
0x000800        0x000805
0x000808        0x006622
0x300000        0x30000d       
 
24111 out of 33816 program addresses used, program memory utilization is 71%


Note however that the program memory will be full when it reads 90%, because that last little bit of memory gets used for IFI stuff.

Greg Ross 05-11-2004 12:01

Re: Simplest Code
 
Quote:

Originally Posted by Mark McLeod
The original IFI_Loader had a bug that only loaded half the available RC program memory. Check your IFI_Loader version. It should be 1.0.7.

Good catch. I had forgotten about that. This version is available from Innovation First at http://www.innovationfirst.com/FIRST...ader_1.0.7.zip. I hope that solves the problem for you.


All times are GMT -5. The time now is 02:54.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi