Cortex m0 64bits support

Asked by lcharpen

Hello

I want to use 64bits variable on a cortex m0 (stm32f0xx).
I can use uint64_t and it seems to work when I am doing uint64_t x += 0xFFFFFFFF. It gives 0x0000000100000000.

I know that cortex m0 doesn't support 64bits but I was wondering if arm-none-eabi-gcc is doing the job for the cortex?
Will it work if I do uint64_t x = 0xFFFFFFFF*10; ?

Thanks for your support

Ludovic

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
lcharpen
Solved:
Last query:
Last reply:
Revision history for this message
42Bastian (bastian-schick) said :
#1

All ARM below ARMv8-A are 32bit CPUs. So it is pretty sure, 64bit variables will work on CM0.
Anyway, why don't you just try it out?

Revision history for this message
lcharpen (ludovic-charpentier) said :
#2

Thanks for you answer.
I need to use 64bits variables to make clock time count on specific devices with a very long life time. I just want to be sure that it would be fine as I saw cortex m0 registers are 32bits.
I force the init time to 0xFFFFFFFF to see if it was ok and it seems to work. I just wanted to be sure that my analysis was good.

Thanks again for your answer

Ludovic

Revision history for this message
Uwe Bonnes (bon) said :
#3

> Will it work if I do uint64_t x = 0xFFFFFFFF*10; ?

Probabbly tagging at least one of the constants as 64-bit will make things clearer:
uint64_t x = 0xFFFFFFFFLL*10; ?

Revision history for this message
Joey Ye (jinyun-ye) said :
#4

Ludovic,

64bit type is supported by GCC for on all 32 bit ARM CPUs, as the 64-bit data type long long is a standard C99 feature and GCC is C99 compliance. C-library (newlib) is not 100% C99 compliance but the missed features should not impact the application you described.

As to implementation, GCC will use multiple 32 bit instructions to implement the 64 bit operations, which won't be as quick as 64 bit CPUs but the correctness of result need not worrying.

Thanks,
Joey