Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,252 Views

Olimex ARM-USB-OCD-H + OpenOCD + Intel Galileo Quark real mode debugging

Hi,

I got a technical problem when using the Olimex ARM-USB-OCD-H with Intel Galileo Board.

Platform : Windows 7 / Windows 10 / Ubuntu

Board : Intel Galileo Gen 1

Software : OpenOCD-0.9.0-rc1 (From Olimex website) / GNU gdb (GDB) 7.6.1

We have modified the Intel Galileo (Quark processor) firmware, so that it can operate in real mode instead of protected mode.

We used Olimex ARM-USB-OCD-H, OpenOCD and gdb for debugging, it works well in the protected mode but got the following errors in real mode.

C:\Users\tcp7628\Desktop>cd C:\Users\tcp7628\Desktop\OpenOCD-OLIMEX-WINDOWS\open 

ocd-0.9.0-rc1\bin-x64

 

 

C:\Users\tcp7628\Desktop\OpenOCD-OLIMEX-WINDOWS\openocd-0.9.0-rc1\bin-x64>openoc

 

d.exe -f ./interface/ftdi/olimex-arm-usb-ocd-h.cfg -f ./target/quark_x10xx.cfg

 

Open On-Chip Debugger 0.9.0-rc1 (2015-04-24-22:09)

 

Licensed under GNU GPL v2

 

For bug reports, read

 

http://openocd.org/doc/doxygen/bugs.html http://openocd.org/doc/doxygen/bugs.html

 

adapter speed: 6000 kHz

 

Info : auto-selecting first available session transport "jtag". To override use

 

'transport select '.

 

Info : clock speed 6000 kHz

 

Info : JTAG tap: quark_x10xx.cltap tap/device found: 0x0e681013 (mfg: 0x009, par

 

t: 0xe681, ver: 0x0)

 

enabling core tap

 

Info : JTAG tap: quark_x10xx.cpu enabled

 

Info : accepting 'gdb' connection on tcp/3333

 

Error: target running, halt it first 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: target running, halt it first

 

Error: x86_32_common_read_memory invalid params count=0x1, buf=00000000007fb7f0,

 

addr=0x00000000

 

Error: target running, halt it first

 

Error: x86_32_common_read_memory invalid params count=0x1, buf=00000000007fb7f0,

 

addr=0x00000000

 

Error: target running, halt it first

 

Error: x86_32_common_read_memory invalid param...
0 Kudos
23 Replies
Highlighted
Community Manager
53 Views

Hi tcp7628,

 

 

Let us investigate this. As soon as we have a proper answer we will let you know. Thank you for your patience.

 

 

-Sergio

 

0 Kudos
Highlighted
Novice
53 Views

Hi Sergio,

Thank you for reply and help.

For your information, before this I was using OpenOCD from Olimex website, now I have tried using the OpenOCD (Open On-Chip Debugger 0.8.0-g0439601 (2014-08-04-10:35)) from Intel Debugger, but still got the same error.

Thank you.

-tcp7628

Highlighted
Novice
53 Views

Hi all,

Sorry that I didn't provide enough details for debugging purpose.

The purpose of this work is to access to the Intel Quark X1000 SOC registers and create assembly language program in real mode.

For the Ia32.asm file from Intel BSP,

\Board_Support_Package_Sources_for_Intel_Quark_v1.2.0\Quark_EDKII_v1.2.0\QuarkPlatformPkg\Cpu\Sec\ResetVector\Ia32

At line 122, JMP $ was inserted before the yellow line highlighted below so that it wont transition from Real Mode to Protected Mode.

; Transition to 16 bit protected mode

;

mov eax, cr0 ; Get control register 0

JMP $ ; modified code

or eax, 00000003h ; Set PE bit (bit # 0) & MP bit (bit # 1)

mov cr0, eax ; Activate protected mode

After that, EDKII firmware was built and a SPI flash image was created - Flash+PlatformData.bin.

Later, I used a tool from Github - GaliProg to program the flash.

("It is a tool (sketch) which allows to read/program/erase/verify SPI flash memory image on Intel® Galileo board.")

Erase the Intel Galileo Gen 1 flash:

Reprogram the Flash

I used the Olimex Debugger and Intel System Debugger OpenOCD to check,

it showed that the SOC core is executing in Real Mode.

However, the OpenOCD and GDB showed errors and the CPU cannot be halted.

Thank you.

-tcp7628

0 Kudos
Highlighted
Employee
53 Views

Could you please post the pictures from your latest reply again? It seems they were not properly attached. We're still investigating on your case. We'll post a suggestion soon.

-Sergio

0 Kudos
Highlighted
Novice
53 Views

Hi Sergio,

I edited the previous reply.

Please help to check again.

Thank you.

-tcp7628

0 Kudos
Highlighted
53 Views

Hi Sergio;

I'm interested to know about this as well.

I'm assisting tcp7628 to get into debug mode in x86 real mode but it just unable to halt.

0 Kudos
Highlighted
53 Views

Any clues you have from your side and are you able to reproduce this issue in your side ?

Thanks !

0 Kudos
Highlighted
Community Manager
53 Views

Hi tcp7628,

 

 

Can you check if the JTAG works normally without any modification on the BSP? I believe the whole UEFI boot code is written for running in protected mode but you modified it to stay in real mode. Therefore, the code is still for protected mode and this might be the cause why you're encountering the error.

 

 

You can see more information in the Intel® Quark™ SoC X1000: Core Developer's Manual here https://www-ssl.intel.com/content/www/us/en/embedded/products/quark/x1000/documentation.html https://www-ssl.intel.com/content/www/us/en/embedded/products/quark/x1000/documentation.html

 

 

-Sergio

 

0 Kudos
Highlighted
53 Views

Hi Sergio;

Can you check if the JTAG works normally without any modification on the BSP?

[Yes, the JTAG works normally without any modification on the BSP.]

0 Kudos
Highlighted
Community Manager
53 Views

We'll investigate further on this case and post a reply soon.

 

 

-Sergio

 

0 Kudos
Highlighted
Community Manager
53 Views

Hi owjian,

 

Make sure only your modified part of SPI NOR flash is updated. There is a binary called RMU.bin in the Flash+PlatformData.bin, if it exists in SPI NOR, Quark won't boot successfully and you'll see the error message you're posting. In our case, we have a 4K binary image to make the Quark X1000 stay in real mode. So we only update the last 4k (from 0x7FF000 to 0x7FFFFF) of the 8MB SPI NOR. Below are our dediprog settings.

 

 

Also, we can use OpenOCD-0.91 to debug in real mode on Galileo gen1.

 

 

 

We used the "jmp "instruction to force the Quark to stay in real mode. So you will see EIP is same below when I do step by step debug.

 

 

Let us know if this is what you were looking for.

-Sergio

0 Kudos
Highlighted
53 Views

Hi Sergio ;

Is the firmware flash possible to be implement on using Galiprog instead of Dediprog ?

0 Kudos
Highlighted
Novice
53 Views

Hi Sergio and Owjian,

Sergio,

Below are the steps that we used to program the SPI NOR.

First, the Flash+PlatformData.bin binary file was renamed to galiprog_flash_write.bin.

Then the file was transferred to the SD card on Intel Galileo Gen 2 (as a programmer)

Connection between the Intel Galileo Gen 2 (programmer) to the Intel Galileo Gen 1 (target board) based on Galiprog user manual.

Arduino serial monitor is used as a serial terminal for Galiprog program.

Below are the few options provided by the Galiprog program.

If the correct file (galiprog_flash_write.bin) is available on the SD card, then we can reprogram the SPI NOR.

We don't have the Dediprog programmer now, and Galiprog program has only the option to reprogram the all memory in the SPI NOR at once.

We will try to modify the Galiprog program so that it can only update the last 4k of the 8MB SPI NOR, is it a good option?

On the same time, could you please share the 4K binary image and briefly explain how to build it.

Also, how to extract the RMU.bin out from the modified Flash+PlatformData.bin? I use Hex Editor Neo program (from HHD software) to open the Flash+PlatformData.bin and disassemble it, but don't know which part is the RMU.bin.

Lastly, can you tell us which debugger that you used in this testing? Just want to make sure the Olimex ARM-USB-OCD-H JTAG debugger is suitable for this project.

Thank you.

-tcp7628

0 Kudos
Highlighted
Community Manager
53 Views

Hi Owjian and tcp7628,

 

 

We'll gather the information with which we performed our test and post it here soon.

 

 

Regards,

 

Sergio

 

0 Kudos
Highlighted
Community Manager
53 Views

Hi Owjian and tcp7628,

 

 

Here's the answers to your questions in the above post.

 

 

Regarding the approach of the Galiprog, we've not used this before. It is an open source tool developed by a community user. I think you should address this question to the author for more details.

 

 

The 4K binary image and instructions on how to extract the RMU.bin out from the modified Flash+PlatformData.bin can be found in Quark BSP. For BSP version 1.2, it is at Quark_EDKII_v1.2.0\QuarkSocPkg\QuarkNorthCluster\Binary\QuarkMicrocode\RMU.bin

 

 

The debuggers we used to make these tests were GDB and OpenOCD.

 

 

Please let us know if this helps to solve your issues.

 

 

We'll be waiting for your response.

 

 

-Sergio

 

0 Kudos
Highlighted
Novice
53 Views

Hi Sergio,

Thank you for your information.

We will post it here once we got any progress or we need more help.

Thank you.

-tcp7628

0 Kudos
Highlighted
Community Manager
53 Views

Glad to know this information helped you. Feel free to post any other question you have.

 

 

-Sergio

 

0 Kudos
Highlighted
Community Manager
53 Views

Hi tcp7628,

 

 

Do you still need assistance with this thread? Was the information we posted useful?

 

 

-Sergio

 

0 Kudos
Highlighted
Novice
53 Views

Hi Sergio,

Ya, I still need assistance with this thread.

Sorry that I took a long time to do testing.

I spent some time try to modify the Galiprog program (https://github.com/xbolshe/galiprog https://github.com/xbolshe/galiprog) so that I can just update the last 4K binary of the SPI NOR,

but I found that I have difficulty to understand the whole program, especially the SPI part.

However, I realized that the Galiprog program allows us to dump/copy the binary of Galileo SPI NOR into bin file format.

I can just modify the bin file by using Hex editor software, then reprogram the SPI NOR using the modified bin file.

Below showed the method that I used to extract the RMU.bin out from the modified Flash+PlatformData.bin.

Then I selected the range of RMU.bin memory from the modified Flash+PlatformData.bin and convert all to 0xFF,

reprogram the Galileo SPI NOR, but still got the same error when trying to halt the Quark X1000.

I think this is not the correct method, but I can't find the instructions on the Quark BSP to extract the RMU.bin,

could you please show more details about how to do it?

Also, about the 4K binary image that can make the Quark X1000 stay in real mode,

is it we can straight away get it from the Quark BSP or we need to build it by using different configuration?

Actually I am not very clear about the methods,is it currently there are two different methods that can be used to make the Quark X1000 stay in real mode:

  1. Modified the IA32.asm file, rebuild the EDKII, create Flash+PlatformData.bin, and then extract out the RMU.bin
  2. Build a new 4K binary image

Thank you for your help. Sorry that my knowledge about the Quark BSP and EDKII still not good enough,

might take a longer time to duplicate your suggested methods.

Thank you!

-tcp7628

0 Kudos