allocate hwtimer assembly directive
Posted: Sat Nov 09, 2019 4:55 pm
Hello,
I am able to allocate a hwtimer in assembly using the getr instruction, and storing the handle to the data section works fine in a timer isr. However, I don't know how to inform the linker that I've used this timer, i.e. when it does the constraints checks it doesn't see that I've allocated this global timer so the constraints check isn't accurate.
I know I can get it to count if I use an xc file that contains and then use that timer in the assembly. When I do an xobjdump, I see the following information
So I was thinking in my assembly file to do
but that gives me an error --
crt1.S: Error: Undefined reference to '_num_global_timers_set'
Any idea what I should do differently so my permanently allocated timer gets picked up in the constraints check?
[EDIT] The reason I want to allocate it in the assembly file is to ensure it's accessible from a 16 bit ldw instruction and won't need a 32 bit ldw instruction.
I am able to allocate a hwtimer in assembly using the getr instruction, and storing the handle to the data section works fine in a timer isr. However, I don't know how to inform the linker that I've used this timer, i.e. when it does the constraints checks it doesn't see that I've allocated this global timer so the constraints check isn't accurate.
I know I can get it to count if I use an xc file that contains
Code: Select all
hwtimer_t mytimer;
Code: Select all
Opcode::SUM_REDUCE _num_global_timers, _num_global_timers_set, 0, 0
ADD_TO_SET _num_global_timers_set, 1, mytimer.ctor, 0
Code: Select all
.sum_reduce _num_global_timers, _num_global_timers_set, 0
.add_to_set _num_global_timers_set, 1
crt1.S: Error: Undefined reference to '_num_global_timers_set'
Any idea what I should do differently so my permanently allocated timer gets picked up in the constraints check?
[EDIT] The reason I want to allocate it in the assembly file is to ensure it's accessible from a 16 bit ldw instruction and won't need a 32 bit ldw instruction.