From: Muller J. <jjm...@su...> - 2004-09-22 07:52:04
|
The "--code-loc" parameter relocates all the code to the given location, = including the interrupt table. Why would the interrupt table be = relocated as well? The first record in the hex record is a ljmp to the = start of my actual code, and this instruction, together with the = interrupt table, must always start at 0x0000 (where the processor will = start execution).=20 If I relocate code,say to external memory 0x4000, I have to manually = edit the hex record so that this ljmp instruction and interrupt table = starts at 0x0000 before the program code will work. Is there any way in = which I can tell SDCC not to relocate the first instruction and the = interrupt table? Also, the internal 8KB RAM of the EZ-USB FX is only usable up to 0x1B3F = for code. I have external memory on the development board, and as I = understand, the PSEN, RD and WR signals are only active for code/program = fetches which doesn't exist in internal RAM. (EA pin tied low, code = internal, data/code external). This means that I can continue with my = code segment at 0x1B40 in external RAM, because the micro will generate = a PSEN signal for locations above 0x1b3F, which is used to enable the = external RAM on the development board. But this doesn't work - as soon = as my program code overflows from internal RAM to external RAM, it stops = working (it does work when I relocate the entire code segment to = external RAM, or if it is kept small enough to fit into internal RAM) = Any ideas what I could be doing wrong? As I understand, the code segment = should be continuous between internal RAM and external RAM.=20 I plan to use an external EEPROM when development is finished (to boot = the device without first downloading firmware), but in the meanwhile I = want to use RAM.=20 Thanks for the help! Jaco M=FCller -----Original Message----- From: sdc...@li... = [mailto:sdc...@li...] On Behalf Of Erik Petrich Sent: 21 September 2004 11:24 PM To: sdc...@li... Subject: Re: [Sdcc-user] FW: 8051/EZ-USB FX code segment On Tue, 21 Sep 2004, Muller Jaco <jjm...@su...> wrote: > I have a very small test program for a EZ-USB FX that switches a LED=20 > on. If I compile the code using "sdcc --code-loc 0x0000 firmware.c",=20 > everything works fine. I would like to run the code segment from=20 > external memory, eg. "sdcc --code-loc 0x4000 firmware.c", but this=20 > doesn't work. It only works when the code starts at 0x000. > =20 > If I look at the .map and .mem files, everything looks like I expected = > it to be (the code segment starts at 0x4000 instead of 0x0000). Is=20 > there something else that I need to look at? You can put the code at a different location, but the processor will = still start execution at 0x0000. To solve this in the project I worked on, I took advantage of the EZ-USB = FX's I2C EEPROM feature. Besides loading configuration data from the = EEPROM, the FX can also automatically load a program from the EEPROM = into the code RAM. Instead of loading my entire program from the EEPROM, = I used it to load the 3 bytes needed for an ljmp instruction that would = jump to the starting address of my external flash chip. Alternatively, you can tie the EA pin high and decode your external code = memory chip at location 0x0000. The disadvantage is that the built-in 8K = of RAM is no longer available for code (it becomes xdata only); this may = or may not be a problem depending on your application. Erik ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 = Project Admins to receive an Apple iPod Mini FREE for your judgement on = who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php = _______________________________________________ Sdcc-user mailing list Sdc...@li... = https://lists.sourceforge.net/lists/listinfo/sdcc-user |