Sharing c variable with assembly file
Posted: Wed Apr 08, 2020 9:36 pm
Hello everybody,
how do I can "share" a variable in my c-file, lets say main.c, with an assembly file, lets say high_level_interrupt.S ?
At the moment I am dealing with setting up high level interrupts, which is working, meaning the high level interrupt is firing up, but how can I now edit global variables which are declared and defined in the main.c within this assembler interrupt routine/handler code ?
I just give the example here from Espressif Team:
Assembly Code:
I already tried to declare the globale Variable with "extern" keyword, but its does not work..
I appreciate every kind of help !
Thank you and best regards,
opcode_x64
how do I can "share" a variable in my c-file, lets say main.c, with an assembly file, lets say high_level_interrupt.S ?
At the moment I am dealing with setting up high level interrupts, which is working, meaning the high level interrupt is firing up, but how can I now edit global variables which are declared and defined in the main.c within this assembler interrupt routine/handler code ?
I just give the example here from Espressif Team:
Assembly Code:
Code: Select all
.section .iram1,"ax"
.global xt_highint5
.type xt_highint5,@function
.align 4
xt_highint5:
*FOR EXAMPLE TO LOAD A NUMBER e.g. 1 IN THE GLOBAL VARIABLE "globVar" defined and declared in main.c*
rsr a0, EXCSAVE_5
rfi 5
Code: Select all
int globVar = 0;
void app_main(){
while(1){
vTaskDelay(1)
}
I appreciate every kind of help !
Thank you and best regards,
opcode_x64