Skip to content

board generator documentation #4989

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

Merged
merged 13 commits into from
Aug 1, 2018
7 changes: 5 additions & 2 deletions doc/faq/a02-my-esp-crashes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ My ESP crashes running some code. How to troubleshoot it?
- `Exception <#exception>`__
- `Watchdog <#watchdog>`__
- `Check Where the Code Crashes <#check-where-the-code-crashes>`__
- `Other Causes for Crashes <#other-causes-for-crashes>`__
- `Other Common Causes for Crashes <#other-causes-for-crashes>`__
- `If at the Wall, Enter an Issue
Report <#if-at-the-wall-enter-an-issue-report>`__
- `Conclusion <#conclusion>`__
Expand Down Expand Up @@ -263,7 +263,7 @@ Asynchronous Callbacks
can happen.

Memory, memory, memory
Running out of heap is the most common cause for crashes. Because the build process for
Running out of heap is the **most common cause for crashes**. Because the build process for
the ESP leaves out exceptions (they use memory), memory allocations that fail will do
so silently. A typical example is when setting or concatenating a large String. If
allocation has failed internally, then the internal string copy can corrupt data, and
Expand All @@ -286,6 +286,9 @@ Memory, memory, memory
modification. For example, std::vector is available for use. The standard implementations
rely on exceptions for error handling, which is not available for the ESP, and in any
case there is no access to the underlying code.

Instrumenting the code with the OOM debug option and calls to ``ESP.getFreeHeap()`` will
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a line about the last memory allocation failure report in the panic that was added a while back?

help the process of finding leaks.

*Some techniques for reducing memory usage*

Expand Down
72 changes: 72 additions & 0 deletions doc/faq/a05-board-generator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
:orphan:

Board generator
---------------

- `How can I run the script ? <#how-can-i-run-the-script>`__
- `What can I do with it ? <#what-can-i-do-with-it>`__
- `When do I need to update it ? <#when-do-i-need-to-mess-with-it>`__
- `Why is my pull-request failing continuous-integration ? <#why-is-my-pull-request-failing-continuous-integration>`__

How can I run the script ?
~~~~~~~~~~~~~~~~~~~~~~~~~~

Python 2 needs to be installed on your system.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work with Python 3?

Copy link
Collaborator Author

@d-a-v d-a-v Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work with Python 3?

No. At least all prints must be updated.

edit: that could be an issue for 2.5.0: all python scripts must be py2/3 agnostic.


The script is located in the ``tools`` subdirectory of the core's root installation.
It needs to be run from the root directory,

::

$ tools/boards.txt.py

::

C:\...> tools\boards.txt.py

Running without parameters will show the command line help. They are
generally self-explanatory.


What can I do with it ?
~~~~~~~~~~~~~~~~~~~~~~~

As of today you can:

* in the IDE: change the default serial programming speed of any board

* in the IDE: add new serial programming speed

* increase available flash space by disabling floats in ``*printf`` functions

* enable WPS which is now disabled by default (at the cost of a smaller heap by ~4KB)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the IDE?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these are in the IDE, right?

Copy link
Collaborator Author

@d-a-v d-a-v Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

float/printf and WPS are not in IDE. The board generator script is currently the only way to change these.

edit: I may have misunderstood. The generator does make changes for usability within the IDE. Some of the changes are not doable from inside the IDE. The generator does them. Then the IDE must be restarted to take effect.
The IDE could do them, but we don't want to flood all users, especially beginners, with thousands of options (arduino, KISS). We already have lots of them. Eclipsification of esp8266/Arduino's IDE shall not happen.


* change led pin ``LED_BUILTIN`` for the two generic boards

* change the default lwIP version (1.4 or 2)


When do I need to mess with it ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The board generator is used to automate configuration files generation when it is
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automate generation of configuration files

possible to. It needs to be edited for:

* All the specific board informations. This is the only place where a new
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All information for specific boards

board (definition, description) can be updated or added to the existing
list.

* Memory mapping for ldscripts (flash and spiffs size combinations)


Why is my pull-request failing continuous-integration ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The generator is able to update a number of files (see list in help), and
global coherency can be checked by the continuous integration facilities.

After a modification in the generator, it is **mandatory** to regenerate all
files (option ``--allgen``) and add them in the pull-request.


`FAQ list :back: <readme.rst>`__
26 changes: 23 additions & 3 deletions doc/faq/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ entering an issue report, please perform initial troubleshooting.
How can I get some extra KBs in flash ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using ``*printf()`` with floats is enabled by default. Some KBs of flash can
be saved by using the option ``--nofloat`` with the boards generator:
* Using ``*printf()`` with floats is enabled by default. Some KBs of flash can
be saved by using the option ``--nofloat`` with the boards generator:

``./tools/boards.txt.py --nofloat --allgen``
``./tools/boards.txt.py --nofloat --allgen``

* Use the debug level option ``NoAssert-NDEBUG`` (in the Tools menu)

`Read more <a05-board-generator.rst>`__.

Why can't I use WPS ?
~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -56,6 +60,8 @@ WPS (and lose 4KB of useable ram), use this boards generator option:

``./tools/boards.txt.py --allowWPS --allgen``

`Read more <a05-board-generator.rst>`__.

This Arduino library doesn't work on ESP. How do I make it work?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -139,3 +145,17 @@ The following lines are compatible with both lwIP versions:
}

Ref. `#1923 <https://github.com/esp8266/Arduino/issues/1923>`__


Why is there a board generator and what about it ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The board generator is a python script originally intended to ease the
Arduino IDE's `boards.txt` configuration file about the multitude of
available board, especially when common data have to be updated for all of
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

available boards

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common data -> common parameters

them.

This script is also used to manage uncommon options that will not find their
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that are currently not available in the IDE menu (we can't say for sure that they will never ever be in the IDE :p)

place into the IDE menu.

`Read more <a05-board-generator.rst>`__.