I've decided to learn ASM again after a long hiatus, and I'm using Arduino Core C to call a basic test .S file I'm linking in. The call passes some parameters in and expects one back. I can see the in bound params hit A10 and A11, and sometime I can ASM to complete a call and return something to C: How do I define the external inputs and access them within ASM, and how do I return a value and change the values of the input C variables? I've tried doing psuedo define ops in the ASM, but no joy.
Any help, pointers, or sources of documentation would be much appreciated.
Heres the code - the loop:
- Serial.println("Fire");
- uint8_t out = test( 0x2F, 0x1F );
- Serial.println("Done");
- Serial.printf("Out: %#010x",out);
- extern "C"
- {
- uint32_t test( uint8_t vone, uint8_t vtwo );
- }
- #include <xtensa/config/specreg.h>
- #include <xtensa/config/core-isa.h>
- #include <xtensa/corebits.h>
- .data
- .global vone
- vone:
- .int 0xAA
- .set voneaddr, vone
- .text
- .align
- .global test
- test:
- movi a14, vone
- l8ui a4, a14, 0
- nop