I have started a simple bare-metal application for the Cortex-A53. Now I want implement interrupts, but I run into an issue. Want to read the registers ICC_SRE_ELx
to determine the SRE
flag, to know if I must use the memory-mapped GIC interface. Want also write to these register, if SRE is enabled, to enable IRQ's and FIQ's.
Got these error messages:
$ makeaarch64-suse-linux-gcc -c -Wall -I ./include -ffreestanding -mcpu=cortex-a53 misc.S -o misc.omisc.S: Assembler messages:misc.S:38: Error: unknown or missing system register name at operand 2 -- `mrs x0,ICC_SRE_EL2'misc.S:42: Error: unknown or missing system register name at operand 2 -- `mrs w0,ICC_SRE_EL2'misc.S:44: Error: unknown or missing system register name at operand 1 -- `msr ICC_SRE_EL2,w0'misc.S:48: Error: unknown or missing system register name at operand 2 -- `mrs x0,ICC_SRE_EL2'misc.S:50: Error: unknown or missing system register name at operand 2 -- `mrs x0,ICC_SRE_EL2'
Wrote this simple code:
#include <asm.h>#define ICC_SRE_EL2_FIQ 0x2#define ICC_SRE_EL2_IRQ 0x4.textFUNCTION(_cpu_get_el) mrs x0, CurrentEL and x0, x0, #0xC asr x0, x0, #2 retFUNCTION(_cpu_get_id) mrs x0, MPIDR_EL1 and x0, x0, #0x3 retFUNCTION(_cpu_get_icc_sre_el2) mrs x0, ICC_SRE_EL2 retFUNCTION(_cpu_set_icc_sre_el2_irq) mrs x0, ICC_SRE_EL2 orr x0, x0, #ICC_SRE_EL2_IRQ msr ICC_SRE_EL2, x0 retFUNCTION(_cpu_set_icc_sre_el2_fiq) mrs x0, ICC_SRE_EL2 orr x0, x0, #ICC_SRE_EL2_FIQ mrs x0, ICC_SRE_EL2 ret.end
I use the following GCC flags:
-Wall -I ./include -ffreestanding -mcpu=cortex-a53
According to the official TRM, these registers should be implemented on the Cortex-A53.
I'm new on this architecture. Any help would be appreciated!
EDIT:
I have tried the following GAS versions:
The package from my used OS (openSUSE Leap 15.1):
$ aarch64-suse-linux-as --versionGNU assembler (GNU Binutils; devel:gcc / openSUSE_Leap_15.1) 2.34.0.20200325-lp151.386Copyright (C) 2020 Free Software Foundation, Inc.This program is free software; you may redistribute it under the terms ofthe GNU General Public License version 3 or later.This program has absolutely no warranty.This assembler was configured for a target of `aarch64-suse-linux'.
The official tool-chains from the ARM homepage:
$ ../gcc/bin/aarch64-none-elf-as --versionGNU assembler (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 2.33.1.20191209Copyright (C) 2019 Free Software Foundation, Inc.This program is free software; you may redistribute it under the terms ofthe GNU General Public License version 3 or later.This program has absolutely no warranty.This assembler was configured for a target of `aarch64-none-elf'.