mb-gdb: problem simulating memory mapped i/o devices

Hello,

I'm trying to simulate a C program in MB-GDB but I get trouble when trying to simulate memory based I/O devices.

I'm not using Microblaze but a improved Openfire core (same ISA) so microblaze toolchain is working for me (I also modified some TCL script inside mb-gdb in order to use the gdb's microblaze simulator instead of XMD).

Seems that GDB marks or initialize only memory regions defined in the executabe program(sections .text, .rodata, .data, etc..) and when my program tries to access the memory area where I/O devices are mapped (outside .text, .data, etc. regions), GDB raises SIGSEGV (segmentation violations signals).

example:

led_status = *(char *) IODEVICE_LEDS; // IODEVICES start at

0x80000000 but program resides from 0x0 to 0x1000

A solution I found is to define the IO device memory area at the end of the linker script and initialize it with some data.

. = _IO_START_ADDR; _iospace : { . = _IO_SIZE; }

This seems to work more or less but I need to execute the program with breakpoints and manually set / read the values of such memory positions in order to simulate the device behaviour.

The question is:

Is there any way in GDB to map a memory location (8, 16 o 32 bit size) to a file for input or output (this is, every time I read[write] from such memory location, the value is readed[writed] from[to] a file ?

Is also possible to use an script connected to such memory location (for example interactively controlling the position of switches or so).

Thank you very much for your help Manuel

Reply to
manuel-lozano
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.