2

So I am working on a bootloader in an embedded c environment. In order for the bootloader to "jump" some assembly language is required within the .c file.

Is there a way similar to This (or other), in VSCode that allows for temporary disabling of formatting?

Just to clarify further the code looks like this:

__asm void boot_jump(uint32_t address)
{
LDR SP, [R0];   Load new stack pointer address
LDR PC,     [ R0, #4 ]; Load new program counter address
}

and VSCode keeps formatting this code to:

__asm void boot_jump(uint32_t address)
{
LDR SP, [R0];
Load new stack pointer address
    LDR PC,
    [ R0, #4 ];
Load new program counter address
}

Which will cause compile errors and will not build. Thanks in advance for any help.

Nick Law
  • 115
  • 3
  • 13

1 Answers1

2

If you change your code to use C comment delimiters such as:

__asm void boot_jump(uint32_t address)
{
LDR SP, [R0];   // Load new stack pointer address
LDR PC,     [ R0, #4 ]; // Load new program counter address
}

Then the formatter will do nothing more that indent the code, which is benign (and prettier):

__asm void boot_jump(uint32_t address)
{
    LDR SP, [R0];       // Load new stack pointer address
    LDR PC, [ R0, #4 ]; // Load new program counter address
}
Clifford
  • 88,407
  • 13
  • 85
  • 165
  • 1
    Uh man, so simple it hurts! Would still be nice to know if it's possible to selectively disable formatting though. – Nick Law Sep 20 '18 at 11:02