Closed Schievel1 closed 4 days ago
The instruction also has to end with a ;, which makes is pretty unusable with the normal ARM assemblers in asm-lsp because everything is red.
By red, do you mean that there's a lot of error diagnostics on screen? If so, this can be fixed by specifying the path to the assembler/ compiler you want to be used on your source file inside your .asm-lsp.toml
config file.
Yes I mean theres lot of errors on the screen. I did not know you can specify a path. I tried this:
[default_config]
version = "0.9.0"
assembler = "C:/Keil_v5/ARM/ARMCC506/armasm.exe"
instruction_set = "arm"
but in emacs it says
LSP :: Invalid global config file -- TOML parse error at line 3, column 13
|
3 | assembler = "C:/Keil_v5/ARM/ARMCC506/armasm.exe"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
unknown variant `C:/Keil_v5/ARM/ARMCC506/armasm.exe`, expected one of `gas`, `go`, `masm`, `nasm`
so I thought I only have those four options.
The config field you're looking for is opts.compiler
. The assembler
field controls which assembler is considered for things like hover documentation and autocomplete. I suggest running "asm-lsp gen-config" from your project's root directory and following those steps to create a config :)
I'll try and revise the docs to make this clearer as well.
Ok I did
[default_config]
version = "0.9.0"
assembler = "nasm"
instruction_set = "arm"
[default_config.opts]
compiler = "/mnt/c/Keil_v5/ARM/ARMCC506/bin/armasm.exe"
compile_flags_txt = []
diagnostics = true
default_diagnostics = false
Judging from the *arm-lsp::stderr*
buffer it seems to work (at least there arent compilation errors):
INFO [asm_lsp::handle] Selected compile command(s) for request: [
CompileCommand {
directory: "",
file: File(
"/mnt/c/svn/Pool-Module/mtb4/mcu/BaseLibrary/trunk/src/main/c/HardwareLayer/Memorytest.s",
),
arguments: Some(
Arguments(
[
"/mnt/c/Keil_v5/ARM/ARMCC506/bin/armasm.exe",
"/mnt/c/svn/Pool-Module/mtb4/mcu/BaseLibrary/trunk/src/main/c/HardwareLayer/Memorytest.s",
],
),
),
command: None,
output: None,
},
]
INFO [asm_lsp::handle] textDocument/diagnostic request serviced in 314ms
INFO [asm_lsp::types] Selected root config
INFO [asm_lsp::handle] textDocument/hover request serviced in 5ms
But now it doesn't display any diagnostics.
Maybe what I am trying to do here is to complicated. I am running Emacs and asm-lsp in WSL2 and runnig an .exe from there. It runs on the command line though.
Yeah, asm-lsp isn't going to be able to use a windows executable from within WSL. Is it possible for you to obtain a linux version of the assembler program?
No, there is none for armcc (v5). There is an assembler in the armclang (v6) package but I think it is a different assembly, much like the normal arm assembly. But I can not use armclang because it's not certified.
Gotcha. The only other option I see is to run eMacs natively from Windows rather than WSL. Unfortunately the server's current diagnostics implementation requires that the assembler/compiler tool and the server can run on the same system.
For some reason ARM Keil v5 projects (with their own armcc, so pre armclang) do not have the usual arm assembly language. They have the same instructions, but they happen to have like endings and different way to set an area like .text and .data, i.e.
AREA |.text|, CODE, READONLY ;
The instruction also has to end with a;
, which makes is pretty unusable with the normal ARM assemblers in asm-lsp because everything is red. Here is a snippet from an assembly file to get an ideaFrom what I can tell the Keil Microvision IDE uses armasm.exe in
...Keil_v5/ARM/ARMCC/bin
Is there any way we can add this? v5 is still in widespread use in the industry as their new Keil v6 armclang compiler isn't certified to be used in safety critical projects.
Problem is that is MS Windows all the way, but I can run the .exe in WSL.