From: Ragnar S. <ra...@na...> - 2001-01-31 04:25:38
|
--On den 29 januari 2001 15:18 -0800 Stephen Williams <st...@ic...> wrote: > > I'm working with a Cypress EZ-USB FX chip that has 8K of on-chip > external ram. That is, the ram is on the chip but external to the > DS80c320 core. This ram is, for this part, both external DATA and > CODE. > > My question is, how can I teach the linker to automatically merge > the xdata and code into a single addressable area? It is not fatal > if I cannot do that, but seems safer to let the linker figure it > out then supply -xram-loc and hope the code space doesn't overrun. As far as I have understood things, you can't. I'm using a shell script to check it, though. I'm using a EZ-USB (not FX) too, with a ported cypress' ezusb framework and compile with this: --model-small --xram-loc 0x1900 to put the xram high up --stack-loc 0xA0 to put the stack where no one will miss it :-) It can get really small if you are using several register banks and don't set move it, here it only competes with IDATA space. --iram-size 0x80 to have the compiler check iram allocation After I have built, I run the small script below, which makes the output even more below. Could be more intelligent, for sure, do some checking for example. You might notice I use a USBJmpTb for USB interrupts at addr 0x1800, that is ported from cypress' ezusb framework. Comments, sugestions and bug reports are welcome! /ragge File checkmap.sh: ----------------------- #!/bin/sh MAPFILE=fw.map RSTFILE=fw.rst echo "Remember: EZ-USB CODE/XDATA ram ends at 0x1B40 (if you don't use usb buffer space)" echo "Remember: BIT space size is 128" echo "Map of file: " $MAPFILE echo "Segment Name Start Size Hex Size Dec Flags" grep "bytes (" $MAPFILE | sort -k 7.10,7 -k 2b,2 -k 3,3 -k 7.0,7.9 echo "Remember: MY Stack ends at 0xFF. Check that ISEG hasn't grown into stack start." echo "Stack start: (hopefully, check it for your self to make certain!)" grep "mov sp,#" $RSTFILE ----------------------- Some output: ----------------------- socko>sh checkmap.sh Remember: EZ-USB CODE/XDATA ram ends at 0x1B40 (if you don't use usb buffer space) Remember: BIT space size is 128 Map of file: fw.map Segment Name Start Size Hex Size Dec Flags . .ABS. 0000 0000 = 0. bytes (ABS,OVR) _CODE 0000 0000 = 0. bytes (REL,CON) DSEG 0030 001C = 28. bytes (REL,CON) OSEG 004C 0000 = 0. bytes (REL,OVR) SSEG 004C 0001 = 1. bytes (REL,CON) ISEG 0080 0000 = 0. bytes (REL,CON) BSEG 0000 0008 = 8. bytes (REL,CON,BIT) CSEG 0000 1156 = 4438. bytes (REL,CON,CODE) GSINIT 1156 000D = 13. bytes (REL,CON,CODE) GSFINAL 1163 0003 = 3. bytes (REL,CON,CODE) HOME 1166 0000 = 0. bytes (REL,CON,CODE) DSCR 1166 00C0 = 192. bytes (REL,CON,CODE) EZUSB 1226 0021 = 33. bytes (REL,CON,CODE) USBJmpTb 1800 0058 = 88. bytes (ABS,OVR,CODE) XSEG 1900 0000 = 0. bytes (REL,CON,XDATA) Remember: MY Stack ends at 0xFF. Check that ISEG hasn't grown into stack start. Stack start: (hopefully, check it for your self to make certain!) 1156 75 81 A0 586 mov sp,#160 ----------------------- |