Crp

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Crp

1,590件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by murnesty on Mon Nov 21 20:48:57 MST 2011
I'm using LPC2368 and red suite nxp 4.

I have problem on using CRP. It prompt error "cannot move location counter backwards".
I had unchecked manage linker script so that I can customize to what I need. It work fine before I copy&paste linker script from the linker script that i temporarily checked manage linker script and enable CRP.

Below is part my main.c
/*
===============================================================================
 Name        : main.c
 Author      : $(author)
 Version     :
 Copyright   : $(copyright)
 Description : main definition
===============================================================================
*/

#include <cr_section_macros.h>
#include <NXP/crp.h>

// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;


and linker file:
/*
* GENERATED FILE - DO NOT EDIT
* (C) Code Red Technologies Ltd, 2008-10
* Generated linker script file for LPC2368
* Created from nxp_lpc23_c.ld (vRed Suite 3 (NXP Edition) v3.6 (3 [Build 318] [11/04/2011] ))
* By Red Suite 3 (NXP Edition) v3.6.3 [Build 318] [11/04/2011]  on Wed Jul 06 21:20:14 SGT 2011
*/


INCLUDE "Test_Custom_lib.ld"
INCLUDE "Test_Custom_mem.ld"

ENTRY(_start)

SECTIONS
{

/* MAIN TEXT SECTION */
.text : ALIGN(4)
{
FILL(0xff)
KEEP(*(.isr_vector))

/* Global Section Table */
. = ALIGN(4) ;
__section_table_start = .;
__data_section_table = .;
LONG(LOADADDR(.data));
LONG(    ADDR(.data)) ;
LONG(  SIZEOF(.data));
LONG(LOADADDR(.data_RAM2));
LONG(    ADDR(.data_RAM2)) ;
LONG(  SIZEOF(.data_RAM2));
LONG(LOADADDR(.data_RAM3));
LONG(    ADDR(.data_RAM3)) ;
LONG(  SIZEOF(.data_RAM3));
LONG(LOADADDR(.data_RAM4));
LONG(    ADDR(.data_RAM4)) ;
LONG(  SIZEOF(.data_RAM4));
__data_section_table_end = .;
__bss_section_table = .;
LONG(    ADDR(.bss));
LONG(  SIZEOF(.bss));
LONG(    ADDR(.bss_RAM2));
LONG(  SIZEOF(.bss_RAM2));
LONG(    ADDR(.bss_RAM3));
LONG(  SIZEOF(.bss_RAM3));
LONG(    ADDR(.bss_RAM4));
LONG(  SIZEOF(.bss_RAM4));
__bss_section_table_end = .;
__section_table_end = . ;
/* End of Global Section Table */


*(.after_vectors*)

/* Code Read Protect data */
. = 0x000001FC ;
PROVIDE(__CRP_WORD_START__ = .) ;
KEEP(*(.crp))
PROVIDE(__CRP_WORD_END__ = .) ;
ASSERT(!(__CRP_WORD_START__ == __CRP_WORD_END__), "Linker CRP Enabled, but no CRP_WORD provided within application");
/* End of Code Read Protect */

*(.text*)
*(.rodata .rodata.*)
. = ALIGN(4);

} > MFlash512

/*
 * for exception handling/unwind - some Newlib functions (in common
 * with C++ and STDC++) use this.
 */
.ARM.extab : ALIGN(4)
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > MFlash512
__exidx_start = .;

.ARM.exidx : ALIGN(4)
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > MFlash512
__exidx_end = .;

_etext = .;


.data_RAM2 : ALIGN(4)
{
   FILL(0xff)
*(.data.$RAM2*)
*(.data.$RAM_ETH_16*)
   . = ALIGN(4) ;
} > RAM_ETH_16 AT>MFlash512

.data_RAM3 : ALIGN(4)
{
   FILL(0xff)
*(.data.$RAM3*)
*(.data.$RAM_USB_8*)
   . = ALIGN(4) ;
} > RAM_USB_8 AT>MFlash512

.data_RAM4 : ALIGN(4)
{
   FILL(0xff)
*(.data.$RAM4*)
*(.data.$RAM_RTC_2*)
   . = ALIGN(4) ;
} > RAM_RTC_2 AT>MFlash512

.SDWriteBlock (NOLOAD):
  {
*(.SDWriteBlock)
} > WriteBlockRAM

.SDReadBlock (NOLOAD):
{
*(.SDReadBlock)
} > ReadBlockRAM

/* MAIN DATA SECTION */

.uninit_RESERVED : ALIGN(4)
{
KEEP(*(.bss.$RESERVED*))
} > Ram32

.data : ALIGN(4)
{
FILL(0xff)
_data = .;
*(vtable)
*(.data*)
. = ALIGN(4) ;
_edata = .;
} > Ram32 AT>MFlash512


.bss_RAM2 : ALIGN(4)
{
*(.bss.$RAM2*)
*(.bss.$RAM_ETH_16*)
   . = ALIGN(4) ;
} > RAM_ETH_16

.bss_RAM3 : ALIGN(4)
{
*(.bss.$RAM3*)
*(.bss.$RAM_USB_8*)
   . = ALIGN(4) ;
} > RAM_USB_8

.bss_RAM4 : ALIGN(4)
{
*(.bss.$RAM4*)
*(.bss.$RAM_RTC_2*)
   . = ALIGN(4) ;
} > RAM_RTC_2

/* MAIN BSS SECTION */
.bss : ALIGN(4)
{
_bss = .;
*(.bss*)
*(COMMON)
. = ALIGN(4) ;
_ebss = .;
PROVIDE(end = .);
} > Ram32

PROVIDE(_pvHeapStart = .);
PROVIDE(_vStackTop = __top_Ram32 - 0);
}


The error is :
"Test_Custom_mem.ld:27 cannot move location counter backwards (from 000002a0 to 000001fc)"
0 件の賞賛
返信
1 返信

1,265件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue Nov 22 03:31:37 MST 2011
On LPC23xx, the CRP is based at address 0x1fc. The linker script is placing your vector table (.isr_vectors), the section table and anything you have placed into the section named ".after_vectors" before this location. However, in your code, that data is too large to fit into the space.

Therefore, you have
- added more vectors into the vector table (the .isr_vector section)
- put more data into the .after_vectors section

You will need to remove data from the above sections until the linker can place the CRP at 0x1fc.
0 件の賞賛
返信