Re: [fpc-devel] How can I distribute code in two different memory areas? (.section)

2013-06-03 Thread Michael Ring

This version worked,

thank you for your help!

Michael

Am 02.06.13 23:20, schrieb Jeppe Græsdal Johansen:

Den 02-06-2013 23:15, Michael Ring skrev:

Unfortunately that does not seem to work (or I use it wrong):

This procedure:

procedure _general_exception_handler; assembler; nostackframe; public 
name '_GENERAL_EXCEPTION_HANDLER';

asm
  .section reset
  sdbbp 0;
  .Lloopb:
   b .Lloopb
end;

translates to:

.section .text.n_pic32mx1xxfxxxc_$$__general_exception_handler
.balign 4
.globl  PIC32MX1XXFXXXC_$$__GENERAL_EXCEPTION_HANDLER
.type PIC32MX1XXFXXXC_$$__GENERAL_EXCEPTION_HANDLER,@function
PIC32MX1XXFXXXC_$$__GENERAL_EXCEPTION_HANDLER:
.globl  _GENERAL_EXCEPTION_HANDLER
.type   _GENERAL_EXCEPTION_HANDLER,@function
_GENERAL_EXCEPTION_HANDLER:
.entPIC32MX1XXFXXXC_$$__GENERAL_EXCEPTION_HANDLER

.section reset
sdbbp   0
.Lj11:
b   .Lj11
jr  $ra
nop
.setmacro
.setreorder
.endPIC32MX1XXFXXXC_$$__GENERAL_EXCEPTION_HANDLER
.Lt3:
.Le2:
.size   PIC32MX1XXFXXXC_$$__GENERAL_EXCEPTION_HANDLER, .Le2 - 
PIC32MX1XXFXXXC_$$__GENERAL_EXCEPTION_HANDLER

.Ll8:

which creates an assembler error:

/Users/ring/devel/fpc/rtl/units/mipsel-embedded/pic32mx1xxfxxxc.s:94: 
Error: operation combines symbols in different segments


the error is from the .size line.



Am 02.06.13 22:51, schrieb Jeppe Græsdal Johansen:

Den 02-06-2013 22:41, Michael Ring skrev:

Hi, perhaps I am overseeing a simple solution for my problem:

On the pic32 there are two flash areas, one at 0x9d00 for the 
main program and another at 0xbfc0 that is called Boot Flash. 
On reset the program starts in the boot flash at the first address.


I have written the startup code for the chips now but I need to 
distribute some procedures between the two memory areas, for 
obvious reasons I must have some code at address 0xbfc0 or the 
chip will not boot correctly ;-).


My thought was now to tweak the linker script in the same way the 
original linker scripts of pic32 work:


MEMORY
{
  kseg0_program_mem(rx)  : ORIGIN = 0x9D00, LENGTH = 0x8
  kseg1_boot_mem : ORIGIN = 0xBFC0, LENGTH = 0x490
}

SECTIONS
{
  .reset _RESET_ADDR :
  {
KEEP(*(.reset))
KEEP(*(.reset.startup))
  }  kseg1_boot_mem
}

In assembler I can then simply write:
 .section .reset,code and
 .section .reset.startup,code

and then the code, this will automagically end up in the 
kseg1_boot_mem, but this does not work with the inline assembler. 
Any ideas on how to do this the correct way? Is there something 
more intelligent than to write a plain assembler file?


TnX,

Michael


You should be able to use
.section .reset 




Try

procedure _general_exception_handler; assembler; nostackframe; public 
name '_GENERAL_EXCEPTION_HANDLER';

asm
  .section reset
  sdbbp 0;
  .Lloopb:
   b .Lloopb
  .text
end;


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Some Opcodes missing in internal assembler for mips32r2

2013-06-03 Thread Sergei Gorelkin

29.05.2013 21:44, Michael Ring пишет:

This is looking good now on first view, all statements seem to pass through now.

The only thing not working is the register error in mfc0 (and friends) command.

Now I will wade through some more code to find out why my nice param 
-CpMIPS32R2 is ignored by
assembler, it still defaults to MIPS2:


I hopefully fixed this issue in r24643, and the register naming issue in r24799.
Should you encounter more issues, do not hesitate to report them.

Regards,
Sergei
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel