Problems with C18 compiler

I am trying to write a program using the Microchip C18 compiler, but ran into a problem. I cannot use any cosine, sine, etc. equations. It tells me that MATH_DATA is full:

“Error - section ‘MATH_DATA’ can not fit the section. Section ‘MATH_DATA’ length=0x00000014”

How do I fix this? It had the same problem with .tmpdata, but I got rid of that by breaking up the math using function into 3 smaller functions.

Also, anyone know a better source than microchips tutorials? Half of their code doesn’t even work.

What’s the target processor? What are you compiling?

I don’t believe I’ve ever seen a message like this. Need more information!

Do searches on the web for the type of code you need + PIC.

Alan KM6VV

18f4685. It won’t let me use even 1 trig function. I am trying to make the brain that calculates the IK formulas.

is their a linker script that needs a certain code or data segment included when the floating point functions are used?

Is there possibly a config screen to enable things like printf() and Math?

What error do you get for sin®? remember to include the math.h header file.

Alan KM6VV

I am including math.h, but it will give the that error I quoted before if I try to do any trig functions.

“Error - section ‘MATH_DATA’ can not fit the section. Section ‘MATH_DATA’ length=0x00000014”

Find an example from Microchip that uses FP. Compile it.

Perhaps your installation is at fault. Re-install it.

Check out one of the Microchip forums. Contact their tech support.

Alan KM6VV

I think I figured it out. Since the PIC has 15 banks, it has to split up these memory sections that it uses. I then realized that maybe the MATH_DATA was trying to fit into the access bank. But I had already declared my udata section to be in the access ram. I got rid of the access ram variables, now it works. How annoying.

That could do it. Although I don’t have to worry about that with the Hitec C compiler, it apperently handles it.

Yes, not the sort of battle you want to have to fight. Need to reserve one’s best efforts for the real problems.

One seems to run into some weird problems when first starting out with a new embedded compiler!

Alan KM6VV