Reading CPU registers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading CPU registers

583 Views
luke_ludington
Contributor II

I want to get the value of a register on the CPU, I looked on the spec sheet and found the address (0xE000E014) and I want to name the variable I store the value in "subticks_per_tick"

This is on a TWR-K65F180M running FreeRTOS.

register uint64_t 0xE000E014 asm ("subticks_per_tick");register uint64_t subticks_per_tick asm ("0xE000E014");

first line gets: error: expected identifier or '(' before numeric constant

second line gets: invalid register name for 'subticks_per_tick'

Any other ways of accessing hardware tick would also be super helpful

Tags (3)
0 Kudos
1 Reply

496 Views
mjbcswitzerland
Specialist V

Hi Luke

unsigned long ulValue = *(unsigned long *)(0xe000e000 + 0x014);

This is the SYSTICK reload value (24 bits are valid/implemented) so you won't need a 64 bit variable to copy it to.
You should avoid assembler since C coding will do it just as efficiently and is compiler independent.


Regards

Mark

Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.html
Including FreeRTOS integration for all Kinetis parts (with free running UART DMA Rx method)
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html

0 Kudos