RichardFerraro
Well-known member
I can't get past TeensyDuino assembler errors with LDR or STR. The following should copy a 16 bit inval to a 32-bit outval. I get:
Error: cannot represent T32_OFFSET_IMM relocation in this object file format
Any guidance here?
#include <stdint.h>
static inline uint32_t CopyInt32(uint16_t inVal) __attribute__((always_inline, unused));
static inline uint32_t CopyInt32(uint16_t inVal)
{
uint32_t outVal;
asm(
"mov r0, %[value] \n\t"
"str %[result], r0 \n\t"
: [result]"=r" (outVal) // outputs
: [value]"r" (inVal) // inputs
: "r0" // clobbers
);
return outVal;
}
void setup()
{
Serial.begin(9600);
}
void loop()
{
uint32_t outValInt32 = CopyInt32(0x1234);
Serial.println(outValInt32,HEX);
delay(100);
}
Error: cannot represent T32_OFFSET_IMM relocation in this object file format
Any guidance here?
#include <stdint.h>
static inline uint32_t CopyInt32(uint16_t inVal) __attribute__((always_inline, unused));
static inline uint32_t CopyInt32(uint16_t inVal)
{
uint32_t outVal;
asm(
"mov r0, %[value] \n\t"
"str %[result], r0 \n\t"
: [result]"=r" (outVal) // outputs
: [value]"r" (inVal) // inputs
: "r0" // clobbers
);
return outVal;
}
void setup()
{
Serial.begin(9600);
}
void loop()
{
uint32_t outValInt32 = CopyInt32(0x1234);
Serial.println(outValInt32,HEX);
delay(100);
}