Giter Club home page Giter Club logo

Comments (4)

sprintersb avatar sprintersb commented on September 28, 2024 1

Reason is that Binutils works on emulation level, i.e. is knows -mavrxmega2 or -mavr51, and the layout of MEMORY regions comes from the emulation default. For example, the top of the default linker scripts read something like (here from avr51.x):

__TEXT_REGION_ORIGIN__ = DEFINED(__TEXT_REGION_ORIGIN__) ? __TEXT_REGION_ORIGIN__ : 0;
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 128K;
__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x800100;
__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xff00;
...
MEMORY
{
  text   (rx)   : ORIGIN = __TEXT_REGION_ORIGIN__, LENGTH = __TEXT_REGION_LENGTH__
  data   (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__
  ...
}

Hence, when symbols like __TEXT_REGION_LENGTH__ are not defined, the core specific defaults are used which are large enough so that all MCUs in that core family will fit.

A canonical place to define these symbols is in the startup code. Stock AVR-LibC currently does not define respective symbols, but there is avrdudes/avr-libc#936 to (weakly) define respective symbols.

crt*.o from atpacks has these symbols defined, so it makes a difference which crt you are using. See avr-nm crt*.o | grep REGION .

For the time being, you can define the symbols on the command line, e.g. -Wl,--defsym,__TEXT_REGION_LENGTH=64k or in the device-specs file, for example:

*link_text_start:
        --defsym __TEXT_REGION_LENGTH=64k

from avr-gcc-build.

armandas avatar armandas commented on September 28, 2024

Update: the issue goes away when using the Atmel DFP (-B ... flag)

from avr-gcc-build.

mobacon avatar mobacon commented on September 28, 2024

Did also run into this problem. The -B flag does not work for me. What flags exactly you use?

Furthermore the SysProgs compiler (only for Windows) works out of the box with correct region size. So somehow it must be possible to get the correct behavior also on Linux.

from avr-gcc-build.

armandas avatar armandas commented on September 28, 2024

@mobacon Did you pass the right argument to -B? I point it to the extracted DFP like this:

-B _deps/atmegadfp/gcc/dev/atmega640

from avr-gcc-build.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.