[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[openrisc] Toolchain and simulator with Cygwin
I've tried to compile the toolchain and the simulator with cygwin.
There were some problems - if any maintainer is interrested in
patching the source, I submit the problems and suggested solutions.
The first problem is that the header file <inttypes.h> is not
supported by cygwin. I implemented this file as a simple header file
myself and put it in /usr/include:
--------------------------------------------
#ifndef _INTTYPES_H_
#define _INTTYPES_H_
#include <sys/types.h>
typedef __uint16_t uint16_t;
typedef __uint32_t uint32_t;
typedef __uint64_t uint64_t;
#endif /* !_INTTYPES_H_ */
--------------------------------------------
Then in Cygwin <curses.h> defines a bool-type which causes conflics in
utils.c in the GDB sources, this can be solved by changing the order
which include files are included, move down include <curses.h> to
below other includes:
Index: gdb/utils.c
===================================================================
RCS file: /home/oc/cvs/or1k/gdb-5.0/gdb/utils.c,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 utils.c
21a22,25
> #ifdef HAVE_CURSES_H
> #include <curses.h>
> #endif
>
27,29d30
< #ifdef HAVE_CURSES_H
< #include <curses.h>
< #endif
This makes GDB compile I think, and then there are also some problems
with compiling the simulator. Same thing as above regarding the
<inttypes.h> file. And also <asm/elf.h> is not found nor needed.
===================================================================
RCS file: /home/oc/cvs/or1k/or1ksim/cpu/common/elf.h,v
retrieving revision 1.1
diff -r1.1 elf.h
4c4
< #include <asm/elf.h>
---
> //#include <asm/elf.h>
Index: parse.c
It seems like 'isblank()' used in parse.c is not ANSI, so the compiler
gives error, I implemented it myself:
===================================================================
RCS file: /home/oc/cvs/or1k/or1ksim/cpu/common/parse.c,v
retrieving revision 1.37
diff -r1.37 parse.c
114a115,121
>
> inline int _isblank (int c)
> {
> return ((c == ' ') || (c == '\t'));
> }
>
>
123c130
< while (*str && !isblank (*str)) str++;
---
> while (*str && !_isblank (*str)) str++;
127c134
< while (*str && isblank (*str)) str++;
---
> while (*str && _isblank (*str)) str++;
In cuc.h it complained that log2() seems to be implemented, the
following patch made it compile
Index: cuc.h
===================================================================
RCS file: /home/oc/cvs/or1k/or1ksim/cuc/cuc.h,v
retrieving revision 1.20
diff -r1.20 cuc.h
212c212
< int log2 (unsigned long x);
---
> //int log2(unsigned long x);
In debug_unit.c I had to remove <inttypes.h>
Index: debug_unit.c
===================================================================
RCS file: /home/oc/cvs/or1k/or1ksim/debug/debug_unit.c,v
retrieving revision 1.13
diff -r1.13 debug_unit.c
35d34
< #include <inttypes.h>
In periperhals-catalog there we some compiler errors then using
backslash in c-lines which needed to be patched:
Index: atadevice.c
===================================================================
RCS file: /home/oc/cvs/or1k/or1ksim/peripheral/atadevice.c,v
retrieving revision 1.3
diff -r1.3 atadevice.c
177,180c177,180
< ata_device_hw_reset(&devices->device1, reset_signal, \
< 1, \ /* assert dasp, this is device1 */
< 0, \ /* negate pdiag input, no more devices */
< 0); /* negate dasp input, no more devices */
---
> ata_device_hw_reset(&devices->device1, reset_signal,
> 1, /* assert dasp, this is device1 */
> 0, /* negate pdiag input, no more devices */
> 0); /* negate dasp input, no more devices */
183,185c183,185
< ata_device_hw_reset(&devices->device0, reset_signal, \
< 0, \
< devices->device1.sigs.pdiago, \
---
> ata_device_hw_reset(&devices->device0, reset_signal,
> 0,
> devices->device1.sigs.pdiago,
191,193c191,193
< ata_device_hw_reset(&devices->device0, reset_signal, \
< 0, \ /* negate dasp, this is device0 */
< 0, \ /* negate pdiag input, there's no device1*/
---
> ata_device_hw_reset(&devices->device0, reset_signal,
> 0, /* negate dasp, this is device0 */
> 0, /* negate pdiag input, there's no device1*/
199,201c199,201
< ata_device_hw_reset(&devices->device1, reset_signal, \
< 0, \ /* negate dasp, this is device0 */
< 0, \ /* negate pdiag input, there's no device1*/
---
> ata_device_hw_reset(&devices->device1, reset_signal,
> 0, /* negate dasp, this is device0 */
> 0, /* negate pdiag input, there's no device1*/
211c211
< void ata_device_hw_reset(ata_device *device, int reset_signal, \
---
> void ata_device_hw_reset(ata_device *device, int reset_signal,
Index: atadevice_cmdi.c
===================================================================
RCS file: /home/oc/cvs/or1k/or1ksim/peripheral/atadevice_cmdi.c,v
retrieving revision 1.2
diff -r1.2 atadevice_cmdi.c
573,587c573,587
< *buf++ = 0 << 15 | \ /* obsolete */
< SUPPORT_NOP_CMD << 14 | \
< SUPPORT_READ_BUFFER_CMD << 13 | \
< SUPPORT_WRITE_BUFFER_CMD << 12 | \
< 0 << 11 | \ /* obsolete */
< SUPPORT_HOST_PROTECTED_AREA << 10 | \
< SUPPORT_DEVICE_RESET_CMD << 9 | \
< SUPPORT_SERVICE_INTERRUPT << 8 | \
< SUPPORT_RELEASE_INTERRUPT << 7 | \
< SUPPORT_LOOKAHEAD << 6 | \
< SUPPORT_WRITE_CACHE << 5 | \
< 0 << 4 | \ /* cleared to zero */
< SUPPORT_POWER_MANAGEMENT << 3 | \
< SUPPORT_REMOVABLE_MEDIA << 2 | \
< SUPPORT_SECURITY_MODE << 1 | \
---
> *buf++ = 0 << 15 | /* obsolete */
> SUPPORT_NOP_CMD << 14 |
> SUPPORT_READ_BUFFER_CMD << 13 |
> SUPPORT_WRITE_BUFFER_CMD << 12 |
> 0 << 11 | /* obsolete */
> SUPPORT_HOST_PROTECTED_AREA << 10 |
> SUPPORT_DEVICE_RESET_CMD << 9 |
> SUPPORT_SERVICE_INTERRUPT << 8 |
> SUPPORT_RELEASE_INTERRUPT << 7 |
> SUPPORT_LOOKAHEAD << 6 |
> SUPPORT_WRITE_CACHE << 5 |
> 0 << 4 | /* cleared to zero */
> SUPPORT_POWER_MANAGEMENT << 3 |
> SUPPORT_REMOVABLE_MEDIA << 2 |
> SUPPORT_SECURITY_MODE << 1 |
594,598c594,598
< *buf++ = 0 << 15 | \ /* cleared to zero */
< 1 << 14 | \ /* set to one */
< 0 << 9 | \ /* reserved */
< SUPPORT_SET_MAX << 8 | \
< 0 << 7 | \ /* reserved for */
---
> *buf++ = 0 << 15 | /* cleared to zero */
> 1 << 14 | /* set to one */
> 0 << 9 | /* reserved */
> SUPPORT_SET_MAX << 8 |
> 0 << 7 | /* reserved for */
600,605c600,605
< SET_FEATURES_REQUIRED_AFTER_POWER_UP << 6 | \
< SUPPORT_POWER_UP_IN_STANDBY_MODE << 5 | \
< SUPPORT_REMOVABLE_MEDIA_NOTIFICATION << 4 | \
< SUPPORT_APM << 3 | \
< SUPPORT_CFA << 2 | \
< SUPPORT_READ_WRITE_DMA_QUEUED << 1 | \
---
> SET_FEATURES_REQUIRED_AFTER_POWER_UP << 6 |
> SUPPORT_POWER_UP_IN_STANDBY_MODE << 5 |
> SUPPORT_REMOVABLE_MEDIA_NOTIFICATION << 4 |
> SUPPORT_APM << 3 |
> SUPPORT_CFA << 2 |
> SUPPORT_READ_WRITE_DMA_QUEUED << 1 |
612c612
< *buf++ = 0 << 15 | \ /* cleared to zero */
---
> *buf++ = 0 << 15 | /* cleared to zero */
619,633c619,633
< *buf++ = 0 << 15 | \ /* obsolete */
< SUPPORT_NOP_CMD << 14 | \
< SUPPORT_READ_BUFFER_CMD << 13 | \
< SUPPORT_WRITE_BUFFER_CMD << 12 | \
< 0 << 11 | \ /* obsolete */
< SUPPORT_HOST_PROTECTED_AREA << 10 | \
< SUPPORT_DEVICE_RESET_CMD << 9 | \
< SUPPORT_SERVICE_INTERRUPT << 8 | \
< SUPPORT_RELEASE_INTERRUPT << 7 | \
< SUPPORT_LOOKAHEAD << 6 | \
< SUPPORT_WRITE_CACHE << 5 | \
< 0 << 4 | \ /* cleared to zero */
< SUPPORT_POWER_MANAGEMENT << 3 | \
< SUPPORT_REMOVABLE_MEDIA << 2 | \
< SUPPORT_SECURITY_MODE << 1 | \
---
> *buf++ = 0 << 15 | /* obsolete */
> SUPPORT_NOP_CMD << 14 |
> SUPPORT_READ_BUFFER_CMD << 13 |
> SUPPORT_WRITE_BUFFER_CMD << 12 |
> 0 << 11 | /* obsolete */
> SUPPORT_HOST_PROTECTED_AREA << 10 |
> SUPPORT_DEVICE_RESET_CMD << 9 |
> SUPPORT_SERVICE_INTERRUPT << 8 |
> SUPPORT_RELEASE_INTERRUPT << 7 |
> SUPPORT_LOOKAHEAD << 6 |
> SUPPORT_WRITE_CACHE << 5 |
> 0 << 4 | /* cleared to zero */
> SUPPORT_POWER_MANAGEMENT << 3 |
> SUPPORT_REMOVABLE_MEDIA << 2 |
> SUPPORT_SECURITY_MODE << 1 |
640,642c640,642
< *buf++ = 0 << 9 | \ /* 15-9 reserved */
< SUPPORT_SET_MAX << 8 | \
< 0 << 7 | \ /* reserved for */
---
> *buf++ = 0 << 9 | /* 15-9 reserved */
> SUPPORT_SET_MAX << 8 |
> 0 << 7 | /* reserved for */
644,649c644,649
< SET_FEATURES_REQUIRED_AFTER_POWER_UP << 6 | \
< SUPPORT_POWER_UP_IN_STANDBY_MODE << 5 | \
< SUPPORT_REMOVABLE_MEDIA_NOTIFICATION << 4 | \
< SUPPORT_APM << 3 | \
< SUPPORT_CFA << 2 | \
< SUPPORT_READ_WRITE_DMA_QUEUED << 1 | \
---
> SET_FEATURES_REQUIRED_AFTER_POWER_UP << 6 |
> SUPPORT_POWER_UP_IN_STANDBY_MODE << 5 |
> SUPPORT_REMOVABLE_MEDIA_NOTIFICATION << 4 |
> SUPPORT_APM << 3 |
> SUPPORT_CFA << 2 |
> SUPPORT_READ_WRITE_DMA_QUEUED << 1 |
656c656
< *buf++ = 0 << 15 | \ /* cleared to zero */
---
> *buf++ = 0 << 15 | /* cleared to zero */
718,720c718,720
< *buf++ = 0 << 15 | \
< 1 << 14 | \
< 0 << 13 | \ /* CBLIBD level (1=Vih,
0=Vil) */
---
> *buf++ = 0 << 15 |
> 1 << 14 |
> 0 << 13 | /* CBLIBD level (1=Vih,
0=Vil) */
722,723c722,723
< 0 << 12 | \ /* reserved
*/
< device->sigs.pdiago << 11 | \ /* 1: Device1 did
assert PDIAG */
---
> 0 << 12 | /* reserved
*/
> device->sigs.pdiago << 11 | /* 1: Device1 did assert
PDIAG */
725c725
< 3 << 9 | \ /* Device1 determined device
number by */
---
> 3 << 9 | /* Device1 determined device
number by */
736,737c736,737
< *buf++ = 0 << 7 | \ /* reserved
*/
< 0 << 6 | \ /* 1: Device0 responds for
device 1 */
---
> *buf++ = 0 << 7 | /* reserved
*/
> 0 << 6 | /* 1: Device0 responds for
device 1 */
739c739
< device->sigs.daspi << 5 | \ /* 1: Device0 did
detected DASP assertion */
---
> device->sigs.daspi << 5 | /* 1: Device0 did
detected DASP assertion */
741c741
< device->sigs.pdiagi << 4 | \ /* Device0 did detect
PDIAG assertion */
---
> device->sigs.pdiagi << 4 | /* Device0 did detect
PDIAG assertion */
743,744c743,744
< 1 << 3 | \ /* Device0 did pass
diagnostics */
< 3 << 1 | \ /* Device0 determined device
number by */
---
> 1 << 3 | /* Device0 did pass
diagnostics */
> 3 << 1 | /* Device0 determined device
number by */
At last some ethernet defines were not present
Index: ethernet_i.h
===================================================================
RCS file: /home/oc/cvs/or1k/or1ksim/peripheral/ethernet_i.h,v
retrieving revision 1.9
diff -r1.9 ethernet_i.h
44a45,51
> #ifndef ETH_HLEN
> #define ETH_HLEN 14 /* Total octets in header (from
include/linux/if_ether.h, if_tr.h) */
> #endif
> #ifndef MSG_DONTWAIT
> #define MSG_DONTWAIT 0x40 /* Nonblocking io (from
include/linux/socket.h) */
> #endif
>
Best Regards,
Fredrik Hederstierna
--
To unsubscribe from openrisc mailing list please visit http://www.opencores.org/mailinglists.shtml