i’m having a very strange situation. Every time I try to compile my arm project (LPC2378, codesourcery arm-none-eabi-gcc-4.5.1) I am left with the same error whilst linking
/media/data/Projects/arm/uart/main.c:39: undefined reference to `__aeabi_uidiv'
/media/data/Projects/arm/uart/main.c:40: undefined reference to `__aeabi_uidiv'
The offending code looks like this:
U0DLL = ((((PLLCFG & 0x7FFF) + 1) * F_OSC) / ((((PLLCFG & (0xFF << 16)) >> 16) + 1) * ((CCLKCFG & 0xFF) + 1) * 8 * BAUD * 1)) % 256;
U0DLM = ((((PLLCFG & 0x7FFF) + 1) * F_OSC) / ((((PLLCFG & (0xFF << 16)) >> 16) + 1) * ((CCLKCFG & 0xFF) + 1) * 8 * BAUD * 1)) / 256;
I’ve searched around and what this can be caused by, AFAICT, not using lgcc & lc options for LD. I’ve resolved that and still the error remains.
The full project can be found at my github repo.
If anybody could help it would be greatly received. Cheers.
The ARM family of CPUs does not have a native integer division instruction. So, division needs to be implemented by a library function. GCC knows this, and creates a reference to (in your case)
__aeabi_uidiv(forunsigned intdivision).You will need to link with an appropriate runtime support library that contains this function.