ide driver code - success
Thomas Doerfler
Thomas.Doerfler at imd-systems.de
Wed Aug 28 06:21:21 UTC 2002
Hi Peter,
all you describe sounds (at least partly) like a visualization
problem between gdb and gcc. At least in some verions gdb is
not so aware which processor registers keep which variables.
The array "data" should be located on the stack (So you might
run into problems, if the stack size is too small). I would
try to look into the array "data" at the end of function
"read_block", chances are good for GDB to locate the buffer
variable properly there.
wkr,
Thomas.
> Hi all,
>
> I'm currently using the ide driver from Thomas to access an IDE drive from my 68332 CPU. So far everthing seems to be fine. I have managed to read out the directory of hda1. Unfortunately this works only with a very small C program. If I build a bigger application the following occures:
>
> I already had a strange effect while adapting the driver code to my system. In the ide code there is a routine loading the MBR to check whether there is a valid partition available etc. Therefore a buffer of 512 bytes is required. In the original code from Thomas this looks like:
>
> ....
> rtems_unsigned8 data[SECTOR_DATA_SIZE];
> ....
> if(read_block(hd, SECTOR_MBR, (rtems_unsigned16 *)data, SECTOR_DATA_SIZE) == 0)
>
> This looks ok but "data" was always corrupt (seems to point in the code area). I changed the code then to
>
> rtems_unsigned16 *data;
> ...
> data = malloc(512);
>
> if(read_block(hd, SECTOR_MBR, data, SECTOR_DATA_SIZE) == 0){
>
> This has worked for my small C test programm bug fails if I have a bigger application. In my opinion both should work. In the bigger application the debugger (ddd) does not even show me "data". Gdb says the symbol is not available. I assume this indicates that I have a problem with my stack
...
>
> I'm not sure if the problem is really related to applicatio size. Any idea how to tackle the problem? Can I use malloc in this early stage of OS initialization? How can I find out the amount of stack, data etc. is available for the OS and application during OS boot?
>
> Any hints welcome,
> Peter
>
--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler Herbststrasse 8
D-82178 Puchheim Germany
email: Thomas.Doerfler at imd-systems.de
PGP public key available at: http://www.imd-
systems.de/pgp_key.htm
More information about the users
mailing list