From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beSuu-0006DR-2T for qemu-devel@nongnu.org; Mon, 29 Aug 2016 16:12:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beSuo-0001gn-Ss for qemu-devel@nongnu.org; Mon, 29 Aug 2016 16:12:23 -0400 Received: from mail.windriver.com ([147.11.1.11]:36277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beSuo-0001gX-Ka for qemu-devel@nongnu.org; Mon, 29 Aug 2016 16:12:18 -0400 From: Bill Paul Date: Mon, 29 Aug 2016 13:30:51 -0700 References: <201608291059.51133.wpaul@windriver.com> In-Reply-To: MIME-Version: 1.0 Message-Id: <201608291330.51148.wpaul@windriver.com> Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] ARM Cortex-M issues List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liviu Ionescu Cc: qemu-devel Of all the gin joints in all the towns in all the world, Liviu Ionescu had = to=20 walk into mine at 12:19:42 on Monday 29 August 2016 and say: > > On 29 Aug 2016, at 20:59, Bill Paul wrote: > >=20 > > I recently started tinkering with ChibiOS as part of a small personal > > project ... >=20 > I did most of the development for the =C2=B5OS++/CMSIS++ > (http://micro-os-plus.github.io) on STM32F4DISCOVERY board, emulated by > GNU ARM Eclipse QEMU, which implements even animated LEDs on a graphical > image of the board. >=20 > FreeRTOS also works properly on the emulator, both the M0 and M3 ports. >=20 > As for Cortex-M implementation, there are many improvements in the GNU ARM > Eclipse QEMU fork (http://gnuarmeclipse.github.io/qemu/), including an > Eclipse debug plug-in to start it; it may be worth giving it a try for > ChibiOS too. I think I've been down this road already with Xilinx ARM support. ("We have= =20 our own fork of QEMU For the MPSoC parts!" "It seems to have diverged a lot= of=20 from the mainline. Also you've only been testing the ARM builds and those o= nly=20 on Linux hosts, and now the code has bitrotted." "Yeah... but... we're goin= g=20 to submit our changes to upstream Real Soon Now (tm).") Note that I'm not suggesting the ARM Eclipse code suffers from bitrot. I'll= =20 give it a try. I just wish all of this was in once place. Also, from a cursory look at the code, it doesn't look like this fork handl= es=20 the NMI interrupt any better than the mainline. The Cortex-M model has an explicit NMI vector in its vector table (#2). It'= s=20 possible to trigger this interrupt via software by writing a 1 to the=20 NMIPENDSET bit in the ICSR register in the System Control Block (which seem= s=20 to be a Cortex-M-specific thing). Currently this vector is treated just like any other IRQ. The problem is th= at=20 means it is also subject to the case where CPSR_I is masked off in the CPU,= =20 which for the NMI is wrong. (How can you mask that which is unmaskabkle?) =46rom looking at how things are structured, I think the only way to make i= t=20 work is to give the target-arm/cpu.c code a separate external NMI pin (e.g.= =20 CPU_INTERRUPT_NMI) and make the arm_gic.c smart enough to trigger that pin= =20 instead of the IRQ or FIQ pins when the NMI is triggered. The handling for= =20 that pin could then be special-cased not to ignore the state of CPSR_I. But that was just from a quick look last night while I was experimenting. I= =20 don't know if maybe there's a better way. This is why I'm here asking=20 questions. :) =2DBill >=20 > Regards, >=20 > Liviu =2D-=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =2DBill Paul (510) 749-2329 | Senior Member of Technical Staff, wpaul@windriver.com | Master of Unix-Fu - Wind River Syste= ms =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D "I put a dollar in a change machine. Nothing changed." - George Carlin =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D