I am trying to make my own syntax highlighting for ARM assembly by defining a language as follows:
\lstdefinelanguage{ASM}{
morekeywords={b, ble, blt, bne,
ldr, str,
r0, r1, r2, r3, r4, r5, r6, r7, rr8, r9, r10, r11, r12
sp },
sensitive=false, % keywords are not case-sensitive
morecomment=[l]{//}, % l is for line comment
morecomment=[s]{/*}{*/}, % s is for start and end delimiter
morestring=[b]" % defines that strings are enclosed in double quotes
} %
However when I do:
\lstset{language=ASM}
\begin{lstlisting}[style = ASM]
.section .init
.global _start
_start:
ldr sp, =8000
b kernel_main
\end{lstlisting}
I am told "undefined control sequence ldr" and "undefined control sequence b". Removing them from the keywords solves the issue but then I have no syntax highlighting. What did I do wrong?
\documentclass
command,l includes all relevant packages and\begin{document}...\end{document}
. In this instance, it won't compile but it should be as small as possible to demonstrate your problem.