.float directive in *.S files
altosack
Posts: 132
This works:
But this doesn't work...:
...so I have to do this:
I'm using the propgcc that came with SimpleIDE 0.9.46 for linux (I don't use SimpleIDE). Does anyone know if this is fixed in the .float directive in newer propgcc versions, or if there is something I don't understand about the syntax ? It fails on the first '/' encountered and doesn't seem to support any arithmetic at all in the .float directive even though the exact same arithmetic works in the .long directive.
Any light anyone can shine on this would be very much appreciated.
#define SCK_PIN 26 SCK_MASK .long 1 << SCK_PIN
But this doesn't work...:
#define ADC_BITS 12 // Don't include sign bit #define VREF 0.604 #define LSB VREF / ((1 << ADC_BITS) - 1) #define S_BAT 0.001 // 1 milli-Ohm Shunt #define BATTERY_AMPS_SAMPLES_BITS 12 batteryAmpsScale .float LSB / S_BAT / (1 << BATTERY_AMPS_SAMPLES_BITS)
...so I have to do this:
batteryAmpsScale .float 0.00003601
I'm using the propgcc that came with SimpleIDE 0.9.46 for linux (I don't use SimpleIDE). Does anyone know if this is fixed in the .float directive in newer propgcc versions, or if there is something I don't understand about the syntax ? It fails on the first '/' encountered and doesn't seem to support any arithmetic at all in the .float directive even though the exact same arithmetic works in the .long directive.
Any light anyone can shine on this would be very much appreciated.
Comments
You could, though, put those constants in a C file: the C compiler is big and compilcated enough that it does implement floating point calculations. You'd have to arrange to link the C compiled output with the assembler output.