News for hackers. Stuff that matters.
Re:How to flash an LED: writing ARM assembly for an STM32 mi... by dmitrygr on Friday April 03, 2020 @06:17PM (#22774472)
@author:

   1     @ Set BR8 field in GPIOA_BSRR, to clear GPIOA8
   2     movw r1, #0x0000
   3     movt r1, #0x0100
you can just use a mov to get that value. Any 8-bit value shifted left any number of bits is synthesizable using one MOV
Re:How to flash an LED: writing ARM assembly for an STM32 mi... by lochsh on Friday April 03, 2020 @06:20PM (#22774498)
This is true! If I was writing something to be optimal speed- and size-wise, I'd do that. I think I just liked the consistency with the other parts of the code where using both was necessary :)
Re:How to flash an LED: writing ARM assembly for an STM32 mi... by lochsh on Friday April 03, 2020 @06:29PM (#22774556)
Oh actually I was being sleepy and hadn't understood what you'd said! I hadn't realised you could do that actually, neat, thanks!

So you could do `mov r1, #0x01000000` right? nice.

Re:How to flash an LED: writing ARM assembly for an STM32 mi... by dmitrygr on Friday April 03, 2020 @06:30PM (#22774565)
yup, some other constants are also loadable in one instr, of the form 0xXX00XX00, 0x00XX00XX, 0xXXXXXXXX where XX is any byte
Re:How to flash an LED: writing ARM assembly for an STM32 mi... by saagarjha on Friday April 03, 2020 @06:37PM (#22774612)
Do you not need the usual LSL, or does the assembler take care of that?
Re:How to flash an LED: writing ARM assembly for an STM32 mi... by dmitrygr on Friday April 03, 2020 @06:41PM (#22774638)
it does, yes