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

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

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

Post by jickster » Mon Nov 20, 2017 8:10 pm

Is mpconfigport.h included in every micropython source file?

If yes, can we rely on this behavior going forward?
Last edited by jickster on Tue Nov 21, 2017 9:12 pm, edited 1 time in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

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

Post by dhylands » Mon Nov 20, 2017 11:18 pm

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.

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

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

Post by jickster » Tue Nov 21, 2017 4:14 pm

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.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

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

Post by dhylands » 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.

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

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

Post by jickster » Tue Nov 21, 2017 8:04 pm

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.

Post Reply