Add "board_f_flash" option to Project Configuration File // Resolve #501

This commit is contained in:
Ivan Kravets
2016-02-10 22:58:12 +02:00
parent 1a4d1c7d40
commit 6baf6568d2
7 changed files with 67 additions and 19 deletions

View File

@@ -7,6 +7,10 @@ PlatformIO 2.0
2.8.4 (2016-02-??)
~~~~~~~~~~~~~~~~~~
* Added ``board_f_flash`` option to `Project Configuration File platformio.ini <http://docs.platformio.org/en/latest/projectconf.html>`__
which allows to specify `custom flash frequency <http://docs.platformio.org/en/latest/platforms/espressif.html#custom-flash-frequency>`_
for Espressif development platform
(`issue #501 <https://github.com/platformio/platformio/issues/501>`_)
* Fixed issue with ``CPPDEFINES`` which contain space and break PlatformIO
IDE Linter
(`IDE issue #34 <https://github.com/platformio/platformio-atom-ide/issues/34>`_)
@@ -46,7 +50,7 @@ PlatformIO 2.0
* Added SPL-Framework support for Nucleo F401RE board
(`issue #453 <https://github.com/platformio/platformio/issues/453>`_)
* Added ``upload_resetmethod`` option to `Project Configuration File platformio.ini <http://docs.platformio.org/en/latest/projectconf.html>`__
and allowed to `change default upload reset method <http://docs.platformio.org/en/latest/platforms/espressif.html#custom-reset-method>`_
which allows to specify `custom upload reset method <http://docs.platformio.org/en/latest/platforms/espressif.html#custom-reset-method>`_
for Espressif development platform
(`issue #444 <https://github.com/platformio/platformio/issues/444>`_)
* Allowed to force output of color ANSI-codes or to disable progress bar even

View File

@@ -9,19 +9,33 @@
See the License for the specific language governing permissions and
limitations under the License.
Custom CPU Frequency or Upload Speed
------------------------------------
Custom CPU Frequency
--------------------
See :ref:`projectconf_board_f_cpu` and :ref:`projectconf_upload_speed` options
from :ref:`projectconf`
See :ref:`projectconf_board_f_cpu` option from :ref:`projectconf`
.. code-block:: ini
[env:myenv]
# set frequency to 40MHz
board_f_cpu = 40000000L
# set frequency to 160MHz
board_f_cpu = 160000000L
upload_speed = 9600
Custom FLASH Frequency
----------------------
See :ref:`projectconf_board_f_flash` option from :ref:`projectconf`. Possible
values:
* 20000000L
* 26000000L
* 40000000L
* 80000000L
.. code-block:: ini
[env:myenv]
# set frequency to 80MHz
board_f_flash = 80000000L
Custom Reset Method
-------------------
@@ -30,10 +44,7 @@ See :ref:`projectconf_upload_resetmethod` option from :ref:`projectconf`
.. code-block:: ini
[env:esp12e]
platform = espressif
framework = arduino
board = esp12e
[env:myenv]
upload_resetmethod = ck
.. _platform_espressif_customflash:
@@ -66,6 +77,16 @@ To override default LD script please use :ref:`projectconf_build_flags` from
[env:myenv]
build_flags = -Wl,-Tesp8266.flash.4m.ld
Custom Upload Speed
-------------------
See :ref:`projectconf_upload_speed` option from :ref:`projectconf`
.. code-block:: ini
[env:myenv]
upload_speed = 9600
.. _platform_espressif_uploadfs:
Uploading files to file system SPIFFS

View File

@@ -208,6 +208,17 @@ The full list of ``board_f_cpu`` for the popular embedded platforms you can
find in *Boards* section of :ref:`platforms`. See "Frequency" column. You can
overclock a board by specifying a ``board_f_cpu`` value other than the default.
.. _projectconf_board_f_flash:
``board_f_flash``
^^^^^^^^^^^^^^^^^
An option ``board_f_flash`` is used to define FLASH chip frequency (Hertz, Clock). A
format of this option is ``C-like long integer`` value with ``L`` suffix. The
1 Hertz is equal to ``1L``, then 40 Mhz (Mega Hertz) is equal to ``40000000L``.
This option isn't available for the all development platforms. The only
:ref:`platform_espressif` supports it.
Building options
~~~~~~~~~~~~~~~~

View File

@@ -14,7 +14,7 @@
import sys
VERSION = (2, 8, "4.dev0")
VERSION = (2, 8, "4.dev1")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@@ -4,6 +4,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP01",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.512k64.ld",
"mcu": "esp8266",
"variant": "generic"
@@ -27,6 +28,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP01",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.1m256.ld",
"mcu": "esp8266",
"variant": "generic"
@@ -50,6 +52,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "nodemcu"
@@ -73,6 +76,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "nodemcu"
@@ -96,6 +100,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "adafruit"
@@ -119,6 +124,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_MOD_WIFI_ESP8266",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.2m.ld",
"mcu": "esp8266",
"variant": "generic"
@@ -142,6 +148,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_THING",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.512k64.ld",
"mcu": "esp8266",
"variant": "thing"
@@ -165,6 +172,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP210",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "generic"
@@ -188,6 +196,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "d1"
@@ -211,6 +220,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "d1_mini"
@@ -234,6 +244,7 @@
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "espino"

View File

@@ -51,6 +51,7 @@ commonvars.AddVariables(
("BOARD",),
("BOARD_MCU",),
("BOARD_F_CPU",),
("BOARD_F_FLASH",),
# upload options
("UPLOAD_PORT",),

View File

@@ -42,17 +42,17 @@ def _get_flash_size(env):
else "%dM" % (board_max_size / 1048576))
def _get_board_f_cpu(env):
f_cpu = env.subst("$BOARD_F_CPU")
f_cpu = str(f_cpu).replace("L", "")
return int(int(f_cpu) / 1000000)
def _get_board_f_flash(env):
frequency = env.subst("$BOARD_F_FLASH")
frequency = str(frequency).replace("L", "")
return int(int(frequency) / 1000000)
env = DefaultEnvironment()
env.Replace(
__get_flash_size=_get_flash_size,
__get_board_f_cpu=_get_board_f_cpu,
__get_board_f_flash=_get_board_f_flash,
AR="xtensa-lx106-elf-ar",
AS="xtensa-lx106-elf-as",
@@ -150,7 +150,7 @@ env.Append(
"eboot", "eboot.elf"),
"-bo", "$TARGET",
"-bm", "dio",
"-bf", "${__get_board_f_cpu(__env__)}",
"-bf", "${__get_board_f_flash(__env__)}",
"-bz", "${__get_flash_size(__env__)}",
"-bs", ".text",
"-bp", "4096",