C++ in-file assembly
I’m trying to migrate from Keil to SW4STM32 so I don’t have to drag along a Windows box just to debug my projects in an Embedded class. I made a new C++ project configured for an STM32F446 Nucleo with no HAL and brought in an existing main.cpp from my last assignment. I didn’t worry too much about the assembly causing complaints in the IDE because it caused complaints before and worked. Now it doesn’t my __asm function is full of errors and doesn’t even seem to get sent to the assembler. I found nothing on in C++ assembly in the docs so if the syntax is slightly different or if I was just being given some slack previously I don’t know. What don’t I know?
__asm int my_sqrt(int x){
PUSH {r4, r5}// push callee stored register
MOV r2, #0// a = 0
MOV r3, #0x0000b504//b = square root of largest possible argument(
MOV r1, #-1// c = -1 (a value we won’t encounter anaturally so equality fails to start)
my_sqrt_loop
CPY r4, r1// c_old