First of all my apologies if I am posting this in the wrong forum. I am using avr-gcc, however the solution to my problem may or may not be avr-gcc specific.
I have been toying recently with a AD9851 dds module which I currently have hooked up to a mega48 also running v-usb (software usb) in cdc mode. In other words it connects to a pc via usb and presents itself as a serial com device.
Naturally space is getting a bit tight but it all works and fits quite comfortably until I try to perform the following calculation in firmware.
#define DDS_XTAL 180000000 unsigned long tuning_word = (frequency * pow(2, 32)) / DDS_XTAL
So at last to my question. Is there any way I can optimize this somehow to squeeze it into my mega48? So far all my attempts to replace the pow function with constants or macros seem to have resulted in even more code and/or compiler warnings.
I guess the obvious solution in upgrade to a mega88 but since there is not that much in it (less than 1K) I thought it might be worth asking.
The other solution (I am currently using) is to have the pc perform the heavy maths and simply send the pre-calculated tuning word to the mcu. This of course requires me to have a custom application to communicate with the module whereas my original intention was to be able control the device via any serial terminal software.
Some readers may be wondering how I am compiling the code and with what optimizations. The answer is that I am using the Makefile (attached) which came with the cdc-io software I adapted to suit my needs.