Sfoglia il codice sorgente

doc: update screenshots and add optimize for code size

Signed-off-by: Huaqi Fang <578567190@qq.com>
Huaqi Fang 5 anni fa
parent
commit
2031007201

BIN
doc/source/asserts/images/nuclei_sdk_open_cmd.png


BIN
doc/source/asserts/images/nuclei_sdk_open_shell.png


BIN
doc/source/asserts/images/nuclei_tools_download_linux.png


BIN
doc/source/asserts/images/nuclei_tools_download_win.png


+ 15 - 0
doc/source/changelog.rst

@@ -3,6 +3,21 @@
 Changelog
 =========
 
+V0.2.0-alpha.xx
+---------------
+
+Release tag name is not yet ready, just record changelog for it.
+
+* Build System
+
+  - Add extra linker options ``-u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek``
+    in Makefile.conf to make sure if you pass extra ``-flto`` compile option, link phase will not fail
+
+* Documentation
+
+  - Add documentation about how to optimize for code size in application development, using ``demo_eclic``
+    as example.
+
 V0.2.0-alpha
 ------------
 

+ 49 - 0
doc/source/design/app.rst

@@ -126,6 +126,7 @@ the CORE TIMER API including the Timer Interrupt and Timer Software Interrupt.
     MTimer SW IRQ handler 10
     MTimer msip and mtip interrupt test finish and pass
 
+.. _design_app_demo_eclic:
 
 demo_eclic
 ~~~~~~~~~~
@@ -133,6 +134,54 @@ demo_eclic
 This `demo_eclic application`_ is used to demostrate how to use
 the ECLIC API and Interrupt.
 
+.. note::
+
+    In this application's Makefile, we provided comments in Makefile about optimize
+    for code size.
+
+    If you want to optimize this application for code size, you can set the ``COMMON_FLAGS``
+    variable to the following values, we recommend to use ``-Os -flto``.
+
+    .. list-table:: Code size optimization for demo_eclic on RV-STAR target
+       :widths: 60 20 20 20 20
+       :header-rows: 1
+
+       * - COMMON_FLAGS
+         - text(bytes)
+         - data(bytes)
+         - bss(bytes)
+         - total(bytes)
+       * -
+         - 13724
+         - 112
+         - 2266
+         - 16102
+       * - -flto
+         - 13598
+         - 112
+         - 2266
+         - 15976
+       * - -Os
+         - 9690
+         - 112
+         - 2264
+         - 12066
+       * - -Os -flto
+         - 9132
+         - 112
+         - 2264
+         - 11508
+       * - -Os -msave-restore  -fno-unroll-loops
+         - 9714
+         - 112
+         - 2264
+         - 12090
+       * - -Os -msave-restore  -fno-unroll-loops -flto
+         - 9204
+         - 112
+         - 2264
+         - 11580
+
 * The timer interrupt and timer software interrupt are used
 * The timer interrupt is registered as non-vector interrupt
 * The timer software interrupt is registered as vector interrupt,

+ 25 - 0
doc/source/develop/appdev.rst

@@ -91,6 +91,28 @@ If you want to add extra build options, you can use these makefile variables:
 * :ref:`develop_buildsystem_var_ldlibs`: This will add extra libraries need to be linked.
 * :ref:`develop_buildsystem_var_libdirs`: This will add extra library directories to be searched by linker.
 
+.. _develop_appdev_optimize_for_codesize:
+
+Optimize For Code Size
+----------------------
+
+If you want to optimize your application for code size, you set ``COMMON_FLAGS``
+in your application Makefile like this:
+
+.. code-block:: makefile
+
+    COMMON_FLAGS := -Os
+
+If you want to optimize code size even more, you use this link time optimization(LTO) as below:
+
+.. code-block:: makefile
+
+    COMMON_FLAGS := -Os -flto
+
+see :ref:`design_app_demo_eclic` for example usage of optimize for code size.
+
+For more details about gcc optimization, please refer to `Options That Control Optimization in GCC`_.
+
 .. _develop_appdev_linkscript:
 
 Change Link Script
@@ -116,3 +138,6 @@ Set Local Make Options For Your Application
 
 If you want to change the application level Make options,
 you can add the :ref:`develop_buildsystem_makefile_local`.
+
+
+.. _Options That Control Optimization in GCC: https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Optimize-Options.html#Optimize-Options