-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boards.txt generator #3722
boards.txt generator #3722
Conversation
Why are entries in 'opts' in a different format (key/value) to the entries in 'macros' (list)? |
Python's dicts do not preserve order (like map:: in c++). |
OrderedDicts preserve order.
I prefer the key value approach of dicts (and arrange my structure
processing to account for the orderlessness - hence the mix of lists in
dicts of my examples) so would subsequently prefer them.
However, I would say yes, consistency is better, particularly when the
different bits are actually to be used in the same place in the output.
On 16/10/2017 8:29 pm, "david gauchard" <notifications@github.com> wrote:
Python's dicts do not preserve order (like map:: in c++).
I had dicts everywhere but I switched later to lists were I needed to
preserve order.
Should I convert 'opts' format to lists ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3722 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAN_A8bRkPEGiap8ZJGNrsZJaqRYQVCfks5sswXGgaJpZM4P57GE>
.
|
By 'preserve order' I was meaning the order coded in the source code which reflects the order in arduino gui's menu. I just learned that python>=3.6 preserves the source order. Or we could use python's OrderedDict (the syntax changes).
This leaves:
If you need the search facility of dicts, I guess I should try and use OrderedDict ? |
There are dicts instead of lists now. |
tools/boards.txt.py
Outdated
if not ('opts' in board) or not (keyval[0] in board['opts']): | ||
print short + keyval[0] + '=' + keyval[1] | ||
for key in macros[block]: | ||
if not ('opts' in board) or not (str(key) in board['opts']): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think the dict makes this line clearer with 'key' instead of 'keyval[0]' :)
It occurred to me a little later that lists would prevent the lookup in line 656 too :) Using an OrderedDict (as you've done) is, I think, the simplest. The other relatively easy approach (though with the layers here I wouldn't recommend it!) is to use boards = dict(...)
for board in boards:
process(board) you instead have boards = dict(...)
menu_order = ['board1', 'board2', 'board3', ...]
for menu_entry in menu_order:
process(boards[menu_entry]) |
Not intending to start a holy war here, but since this is Python, can we switch indentation to spaces? |
I hope I understood everything well with the last commit. |
My question is about the 'helper function 'flash_size' - I'm wondering what advantage this provides over specifying the flash info in the same way as for the other board info (in I'm also not a fan of positional arguments (particularly when mixed with keyword arguments) and would vote for using keyword arguments across the board. |
I vaguely remember writing something about 'helper function flash_size' some time ago, but can't even find my own comment anymore. Anyway, current changeset looks good to me! |
This question has raised about the default serial upload speed. In the script I put 115200 by default for all boards, because
But after checking, it appears that at least the |
I like reliability so I'd vote 115200 (or other well known minimum).
Changing things like boards.txt should be for improvement (faster) rather
than functionality (works at all)
…On 6/11/2017 12:09 pm, "david gauchard" ***@***.***> wrote:
This question has raised
<32f6826>
about the default serial upload speed. In the script I put 115200 by
default for all boards, because
- I thought it was like that in the old boards.txt
- It is the most compatible value (I experienced problems with 921k on
macOS and wemos, 460k was ok)
But after checking, it appears that at least the Wemos D1 R2/mini had
921k by default.
So should we use 921k by default for all boards ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3722 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAN_A0OO7AOfRcYuC7FeP8hA4nQm0vH9ks5szkBEgaJpZM4P57GE>
.
|
Originally I thought it would be up to the board author to pick the highest
baud rate which worked reliably for a given board as the default. In my
experience, both nodeMCU 1.0 and D1 mini/ mini pro work reliably at 921600.
I think setting that as a default is okay as long as the user has an option
to lower the baud rate.
…On Mon, Nov 6, 2017, 07:15 Julian Davison ***@***.***> wrote:
I like reliability so I'd vote 115200 (or other well known minimum).
Changing things like boards.txt should be for improvement (faster) rather
than functionality (works at all)
On 6/11/2017 12:09 pm, "david gauchard" ***@***.***> wrote:
> This question has raised
> <
32f6826
>
> about the default serial upload speed. In the script I put 115200 by
> default for all boards, because
>
> - I thought it was like that in the old boards.txt
> - It is the most compatible value (I experienced problems with 921k on
> macOS and wemos, 460k was ok)
>
> But after checking, it appears that at least the Wemos D1 R2/mini had
> 921k by default.
> So should we use 921k by default for all boards ?
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#3722 (comment)>,
or mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/AAN_A0OO7AOfRcYuC7FeP8hA4nQm0vH9ks5szkBEgaJpZM4P57GE
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3722 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEJcevP3hfxoIAemNfmIb8dbP8fJhmHjks5szkGWgaJpZM4P57GE>
.
|
It's potentially install dependant (board authority is best source,
hopefully) which leads me to the other thought about local overrides. Is it
worth having a .local with settings the script will use in preference to
the distribution options. Particularly with baud rates it might be handy..?
…On 6/11/2017 2:34 pm, "Ivan Grokhotkov" ***@***.***> wrote:
Originally I thought it would be up to the board author to pick the highest
baud rate which worked reliably for a given board as the default. In my
experience, both nodeMCU 1.0 and D1 mini/ mini pro work reliably at 921600.
I think setting that as a default is okay as long as the user has an option
to lower the baud rate.
On Mon, Nov 6, 2017, 07:15 Julian Davison ***@***.***>
wrote:
> I like reliability so I'd vote 115200 (or other well known minimum).
> Changing things like boards.txt should be for improvement (faster) rather
> than functionality (works at all)
>
> On 6/11/2017 12:09 pm, "david gauchard" ***@***.***>
wrote:
>
> > This question has raised
> > <
> 32f6826
8517b55a9e
> >
> > about the default serial upload speed. In the script I put 115200 by
> > default for all boards, because
> >
> > - I thought it was like that in the old boards.txt
> > - It is the most compatible value (I experienced problems with 921k on
> > macOS and wemos, 460k was ok)
> >
> > But after checking, it appears that at least the Wemos D1 R2/mini had
> > 921k by default.
> > So should we use 921k by default for all boards ?
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub
> > <#3722 (comment)>,
> or mute
> > the thread
> > <
> https://github.com/notifications/unsubscribe-auth/AAN_
A0OO7AOfRcYuC7FeP8hA4nQm0vH9ks5szkBEgaJpZM4P57GE
> >
> > .
> >
>
> —
> You are receiving this because you commented.
>
>
> Reply to this email directly, view it on GitHub
> <#3722 (comment)>,
or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/
AEJcevP3hfxoIAemNfmIb8dbP8fJhmHjks5szkGWgaJpZM4P57GE>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3722 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAN_A6QAlYEXVz81Buj2pZLkaL1oM9OSks5szmIlgaJpZM4P57GE>
.
|
You mean boards.txt.local? I think the IDE actually supports some kind of a
local override file, but can't find a reference to it now, need to look at
the source code.
…On Mon, Nov 6, 2017, 09:38 Julian Davison ***@***.***> wrote:
It's potentially install dependant (board authority is best source,
hopefully) which leads me to the other thought about local overrides. Is it
worth having a .local with settings the script will use in preference to
the distribution options. Particularly with baud rates it might be handy..?
On 6/11/2017 2:34 pm, "Ivan Grokhotkov" ***@***.***> wrote:
> Originally I thought it would be up to the board author to pick the
highest
> baud rate which worked reliably for a given board as the default. In my
> experience, both nodeMCU 1.0 and D1 mini/ mini pro work reliably at
921600.
> I think setting that as a default is okay as long as the user has an
option
> to lower the baud rate.
>
> On Mon, Nov 6, 2017, 07:15 Julian Davison ***@***.***>
> wrote:
>
> > I like reliability so I'd vote 115200 (or other well known minimum).
> > Changing things like boards.txt should be for improvement (faster)
rather
> > than functionality (works at all)
> >
> > On 6/11/2017 12:09 pm, "david gauchard" ***@***.***>
> wrote:
> >
> > > This question has raised
> > > <
> >
32f6826
> 8517b55a9e
> > >
> > > about the default serial upload speed. In the script I put 115200 by
> > > default for all boards, because
> > >
> > > - I thought it was like that in the old boards.txt
> > > - It is the most compatible value (I experienced problems with 921k
on
> > > macOS and wemos, 460k was ok)
> > >
> > > But after checking, it appears that at least the Wemos D1 R2/mini had
> > > 921k by default.
> > > So should we use 921k by default for all boards ?
> > >
> > > —
> > > You are receiving this because you commented.
> > > Reply to this email directly, view it on GitHub
> > > <#3722 (comment)
>,
> > or mute
> > > the thread
> > > <
> > https://github.com/notifications/unsubscribe-auth/AAN_
> A0OO7AOfRcYuC7FeP8hA4nQm0vH9ks5szkBEgaJpZM4P57GE
> > >
> > > .
> > >
> >
> > —
> > You are receiving this because you commented.
> >
> >
> > Reply to this email directly, view it on GitHub
> > <#3722 (comment)>,
> or mute
> > the thread
> > <https://github.com/notifications/unsubscribe-auth/
> AEJcevP3hfxoIAemNfmIb8dbP8fJhmHjks5szkGWgaJpZM4P57GE>
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#3722 (comment)>,
or mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/AAN_A6QAlYEXVz81Buj2pZLkaL1oM9OSks5szmIlgaJpZM4P57GE
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3722 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEJcenpv7QGzIL_zVmWXKrZ4Y51kgU-yks5szmMwgaJpZM4P57GE>
.
|
Exactly, though I also wasn't sure if the ide had support (unlike
platform.txt.local, I think it is). We can certainly offer it in the
generation script regardless (so I started there).
…On 6/11/2017 3:05 pm, "Ivan Grokhotkov" ***@***.***> wrote:
You mean boards.txt.local? I think the IDE actually supports some kind of a
local override file, but can't find a reference to it now, need to look at
the source code.
On Mon, Nov 6, 2017, 09:38 Julian Davison ***@***.***>
wrote:
> It's potentially install dependant (board authority is best source,
> hopefully) which leads me to the other thought about local overrides. Is
it
> worth having a .local with settings the script will use in preference to
> the distribution options. Particularly with baud rates it might be
handy..?
>
>
>
> On 6/11/2017 2:34 pm, "Ivan Grokhotkov" ***@***.***>
wrote:
>
> > Originally I thought it would be up to the board author to pick the
> highest
> > baud rate which worked reliably for a given board as the default. In my
> > experience, both nodeMCU 1.0 and D1 mini/ mini pro work reliably at
> 921600.
> > I think setting that as a default is okay as long as the user has an
> option
> > to lower the baud rate.
> >
> > On Mon, Nov 6, 2017, 07:15 Julian Davison ***@***.***>
> > wrote:
> >
> > > I like reliability so I'd vote 115200 (or other well known minimum).
> > > Changing things like boards.txt should be for improvement (faster)
> rather
> > > than functionality (works at all)
> > >
> > > On 6/11/2017 12:09 pm, "david gauchard" ***@***.***>
> > wrote:
> > >
> > > > This question has raised
> > > > <
> > >
> 32f6826
> > 8517b55a9e
> > > >
> > > > about the default serial upload speed. In the script I put 115200
by
> > > > default for all boards, because
> > > >
> > > > - I thought it was like that in the old boards.txt
> > > > - It is the most compatible value (I experienced problems with 921k
> on
> > > > macOS and wemos, 460k was ok)
> > > >
> > > > But after checking, it appears that at least the Wemos D1 R2/mini
had
> > > > 921k by default.
> > > > So should we use 921k by default for all boards ?
> > > >
> > > > —
> > > > You are receiving this because you commented.
> > > > Reply to this email directly, view it on GitHub
> > > > <#3722#
issuecomment-342013817
> >,
> > > or mute
> > > > the thread
> > > > <
> > > https://github.com/notifications/unsubscribe-auth/AAN_
> > A0OO7AOfRcYuC7FeP8hA4nQm0vH9ks5szkBEgaJpZM4P57GE
> > > >
> > > > .
> > > >
> > >
> > > —
> > > You are receiving this because you commented.
> > >
> > >
> > > Reply to this email directly, view it on GitHub
> > > <#3722 (comment)
>,
> > or mute
> > > the thread
> > > <https://github.com/notifications/unsubscribe-auth/
> > AEJcevP3hfxoIAemNfmIb8dbP8fJhmHjks5szkGWgaJpZM4P57GE>
> > > .
> > >
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub
> > <#3722 (comment)>,
> or mute
> > the thread
> > <
> https://github.com/notifications/unsubscribe-auth/AAN_
A6QAlYEXVz81Buj2pZLkaL1oM9OSks5szmIlgaJpZM4P57GE
> >
> > .
> >
>
> —
> You are receiving this because you commented.
>
>
> Reply to this email directly, view it on GitHub
> <#3722 (comment)>,
or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AEJcenpv7QGzIL_
zVmWXKrZ4Y51kgU-yks5szmMwgaJpZM4P57GE>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3722 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAN_A3DTGIXEdPIC_TCPa0PyFy0aw3cAks5szml0gaJpZM4P57GE>
.
|
and what about writing by default a " |
I like that idea.
I've also been wondering if a console-text-based question/answer wizard
might be useful. It could also offer this sort of thing (the other obvious
inclusion would be turning entire boards on or off, and the like)
…On Mon, Nov 6, 2017 at 9:40 PM, david gauchard ***@***.***> wrote:
and what about writing by default a "secure 115200" config, with command
line options for users willing to regenerate with other defaults ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3722 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAN_A3xs301GEF50YQFUmX7b8fbHXMihks5szsXogaJpZM4P57GE>
.
|
Just checked, it is "boards.local.txt", from revisions.txt:
|
@davisonja @d-a-v what's the status on this? |
Current output is in master's board.txt with so far no issues. |
I am in theory, but have been a bit pressed for time this week. Will get onto it this weekend properly. I think should have an additional function for generating the ldscripts (possibly refactor so we have several functions that output to the file system, one for ldscripts and one for boards.txt itself?) to keep the flow clean. |
@davisonja @igrr Unless you think it is unwise, I plan to produce |
@d-a-v I was actually going to suggest the same thing. Not generating makes for doc maintenance, and additional issues. |
I'm trying to implement 4M/2M SPIFFS variant an I ended with attached linker script and following modification to boards.txt: generic.menu.FlashSize.4M2M=4M (2M SPIFFS) So I'm asking to guide how to add this into the generator? |
@Pablo2048 |
@d-a-v thank You. And how to handle the linker script? |
@d-a-v looks like this line did the trick |
with option
|
f6a8429
to
e6898b6
Compare
All commit are squashed into a single one. commit log:
Only boards.txt is updated (OOM debug option, led menu for the generic board and I included #4083) This needs review (the script itself only if you have too much time). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only comment is whether the const char strings passed to os_printf() can be put in flash. There are several instances.
cores/esp8266/heap.c
Outdated
{ | ||
void* ret = umm_malloc(s); | ||
if (!ret) | ||
os_printf(":oom(%d)@?\n", (int)s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the strings like this one ":oom()blah" be put in flash?
+ generates boards.rst + generate and replace boards section in package.json + generate ldscripts + new debug option: OOM + new led menu for generic board
all these strings are now moved to flash
|
I think this has been reviewed enough. If there are further things to change, let's discuss it in a new PR. |
To quickly try it in a separate branch:
git fetch origin pull/3722/head:pr-3722 && git checkout pr-3722; git branch
tools/boards.txt.py --help
tools/boards.txt.py > boards.txt
and restart arduino.
latest boards.txt - without debug option NULL nor generic boards' LED_BUILTIN_LED
2.4.0rc2 boards.txt before the generator
TODO: #3982