Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8791509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:51:09+00:00 2026-06-13T22:51:09+00:00

There is a project which successfully compiled linked and run on the device. But

  • 0

There is a project which successfully compiled linked and run on the device.
But after telling the linker that it should put the part of the application code to the ROM memory, instead of SDRAM, I am getting the following error at the linking step:

Error[Lp002]: relocation failed: value out of range or illegal:
0x60000545
Kind : R_ARM_PREL31[0x2a]
Location: 0xa0000030
Module: I:\Project\Debug\Obj\fileOper.o
Section: 128 (.ARM.exidx)
Offset: 0x0
Target : 0x00000574
“SECTION_FILEOP_87”
Module: I:\Project\Debug\Obj\fileOper.o
Section: 104 (SECTION_FILEOP)
Offset: 0x4f4

I have read the C/C++ guide from IAR. But it doesn’t provide well enough explanations regarding this error. So even reading the manual I can’t get the reason of this error. Can anybody help to resolve this problem?
Actually the IAR C/C++ developers guide says:

For each instruction that cannot be relocated correctly, ILINK will
generate a relocation error. This can occur for instructions where the
target is out of reach or is of an incompatible type, or for many
other reasons.
Then it provides the error as an example which is different than in my case.

EDIT 1: I have created the small project which reproduce the same errors and it consists of fileOper.cpp and main.cpp files only.

The ICF file used to tell linker how to put sections to memory:

define symbol intvec_start = 0x10000000;

/-Memory Regions-/

/-FLASH ROM-/

define symbol FLASH_ROM_start = 0x00000000;

define symbol FLASH_ROM_end = 0x0007FFFF;

/*Internal RAM*/

define symbol RAM_start = 0x10000000;

define symbol RAM_end = 0x10017FFF;

/*SDRAM*/

define symbol SDRAM_start = 0xA0000000;

define symbol SDRAM_end = 0xA1FFFFFF;

/-Sizes-/

define symbol size_stack = 0x4000;

define symbol size_heap = 0x2000;

define memory mem with size = 4G;

define region FLASH_region = mem:[from FLASH_ROM_start to
FLASH_ROM_end];

define region RAM_region = mem:[from RAM_start to RAM_end];

define region SDRAM_region = mem:[from SDRAM_start to SDRAM_end];

define block CSTACK with alignment = 8, size = size_stack { };

define block HEAP with alignment = 8, size = size_heap { };

initialize by copy with packing = zeros { readwrite };

do not initialize { section .noinit };

place at address mem: intvec_start { section .intvec };

place at start of FLASH_region { readonly section .cstartup };

place in RAM_region { block CSTACK };

place in SDRAM_region { readonly }

except {readonly section FILEOP };

place in SDRAM_region { readwrite };

place in SDRAM_region { block HEAP};

place in FLASH_region { readonly section FILEOP };

fileOper.cpp: I have changed it, but it still reproduce the same error.

#include "fileOperbug.h"
#include <string>

char *fgets( char *str, int num, std::string *stream ) {

  char *pointer = 0;
  return pointer;
}

std::string *fopen(const char *name, const char *mode) {
  std::string *str = new std::string();
  str->assign("");
  return str;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:51:10+00:00Added an answer on June 13, 2026 at 10:51 pm

    I have resolved the problem.
    While using IAR Embedded workbench:
    Project options -> C/C++ Compiler -> Language 1 tab.
    There at the “C++ dialect” there was a checkbox named “with exceptions” at it was checked.
    The error at linking stage happens when “with exceptions” checkbox is checked.
    All code that uses exceptions must be loaded to ROM. Otherwise the “with exceptions” should be unchecked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are two project in which I collaborate, they live in different servers, A
Is there any open source engine project which can classify online text or article.
In my project there is a listview which contains textview and checkbox..Here is my
In my project there are large no. of FIXME / TODO which are to
I'm working on a C++ project in which there are a lot of classes
I am working on a JAVA project in which there are multiple terminals. These
Are there any tools which generate a project layout for python specific projects, much
Is there any Eclipse plugin which autobackup a project every so and so minutes
Hi there Stackoverflowers! I was coding a project when I wondered which is the
I have a following situation in my project. There are some tag values which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.