FreeRTOS on Advantech PCM-3356 (IA32 mode i686 processor)

dave-the-rave wrote on Wednesday, March 02, 2016:

I am using an Advantech PCM-3356, which has an AMD i686 processor.
Currently, I can compile FreeRTOS using gcc under Linux and get grub
to load it onto the 686. I still need to set up the timer interrupt,
integrate the scheduler with the tick, etc. (This is the IA32 mode of operation.)

Is there any way I could get a copy of the Board Support Package (BSP)
for this board?

The Advantech in question is a current production industrial ruggedized
PC clone, and runs Linux Mint 17.2 with no problem. Any BSP which supports
IA32 mode on a standard PC-type computer should work.

rtel wrote on Wednesday, March 02, 2016:

I presume this is the port you are using: http://www.freertos.org/RTOS_Intel_Quark_Galileo_GCC.html - that should set up the timer interrupt and integrate the scheduler with the tick for you.

What are you looking for in the BSP? (what needs to be supported?)

dave-the-rave wrote on Wednesday, March 02, 2016:

I am using that port, or at least parts of it. Specifically:

BaseType_t xPortInstallInterruptHandler( ISR_Handler_t pxHandler,
uint32_t ulVectorNumber );

The problem is that I can get swi to work just fine, but cannot get an IRQ 5 to fire.
The IRQ 5 is connected to an old-fashioned PC/104 bus and appears on the
8259 input pins (or their virtual equlvalent).

Three questions:
Is this thing using the PIC, the APIC, or something else?
I am using grub as the bootloader, which puts the cpu into flat IA32-bit mode, but which requires that I call the routine which does asm(“lidt”) before any interrupt service routine will run. Is this going to cause some kind of problem?
Do I have to change the interrupt vector location? If so, how do I do that?

rtel wrote on Wednesday, March 02, 2016:

That demo is using the APIC (predominantly at least, I think there are some interrupts routed via the legacy PIC used in the demo app).

The demo also uses grub - I think there is a pdf linked from the documentation page that gives more detail. With regards to setting up the APIC and IDT, see https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/portable/GCC/IA32_flat/port.c - the tables are set up before the scheduler is started, you can search for the lidt instruction being used.

dave-the-rave wrote on Wednesday, March 02, 2016:

I have read most of this, including the port.c. My question is, where does it put the vectors for the legacy interrupts (com1, com2, lpt1, etc?) I suspect that if I was to be sure about where exactly to put the vector, that would be half the problem solved.

I notice that, after grub has finished and after calling the port.c init stuff, the PIC registers contain non-zero mask bits, which implies that the PIC is being used. True?

rtel wrote on Thursday, March 03, 2016:

I’m afraid I don’t know much about grub, but presume how it leaves the
CPU will depend on your grub build or configuration.