Page 1 of 1

[SOLVED]Is mpconfigport.h included in every micropython source file?

Posted: Mon Nov 20, 2017 8:10 pm
by jickster
Is mpconfigport.h included in every micropython source file?

If yes, can we rely on this behavior going forward?

Re: Is mpconfigport.h included in every micropython source file?

Posted: Mon Nov 20, 2017 11:18 pm
by dhylands
What/why are you really asking?

You can run the following command (under linux) from inside the build directory to get a list of the files which don't include mpconfigport.h:

Code: Select all

find . -name '*.P' -exec fgrep -L mpconfigport.h {} \;
The files listed come from lib/libm, lib/libc and the HAL.

The *.P files are the dependency files which are produced by the compiler.

Re: Is mpconfigport.h included in every micropython source file?

Posted: Tue Nov 21, 2017 4:14 pm
by jickster
dhylands wrote:
Mon Nov 20, 2017 11:18 pm
What/why are you really asking?
I need to tell my linker to place the archive containing the micropython objects in a certain section like so

Code: Select all

.dflash_code :
  {
    *\ATI_micropython.dlb:* // this is my archive file
  } >dflash
Unfortunately it's not working
https://stackoverflow.com/questions/473 ... in-section

The brute-force method of doing this is to add

Code: Select all

__attribute__((section(".dflash_code")))
to every function's definition.

I'd like to assign that to a macro but it looks like there's no one .h included by every .c file.

Re: Is mpconfigport.h included in every micropython source file?

Posted: Tue Nov 21, 2017 8:02 pm
by dhylands
That's definitely something that you should be able to do in the linker script file. I know that linker script files are very picky about having the syntax exactly right, and tend to silently ignore stuff it doesn't like.

I think that you should modify your linker script to look like this:

Code: Select all

    dflash_code :
    {
        ATI_micropython.dlb:*(.text*)
     } >dflash
The \ is probably being treated not as a directory seperator, so I'd eliminate it and make sure you specify a -L option containing the directory with the ATI_micropython.dlb file in it. I'm assuming you only want code in the dflash_code section. If you want more, then specify each section type that you want on a separate line. If you specify all sections then you'll get debug stuff and lots of other stuff that you don't want.

Re: Is mpconfigport.h included in every micropython source file?

Posted: Tue Nov 21, 2017 8:04 pm
by jickster
dhylands wrote:
Tue Nov 21, 2017 8:02 pm
That's definitely something that you should be able to do in the linker script file. I know that linker script files are very picky about having the syntax exactly right, and tend to silently ignore stuff it doesn't like.

I think that you should modify your linker script to look like this:

Code: Select all

    dflash_code :
    {
        ATI_micropython.dlb:*(.text*)
     } >dflash
The \ is probably being treated not as a directory seperator, so I'd eliminate it and make sure you specify a -L option containing the directory with the ATI_micropython.dlb file in it. I'm assuming you only want code in the dflash_code section. If you want more, then specify each section type that you want on a separate line. If you specify all sections then you'll get debug stuff and lots of other stuff that you don't want.
I figure it out: there was a section above that was placing all *.text into the wrong section; since it appeared first in the linker file, it took precedence over my .dflash_code entry.


I moved my .dflash_code above it and it works now.