nuttx/Documentation/guides/drivers/ofloader.rst
Vinicius May f6ecf80ebb Documentation: brand new layout for NuttX documentation.
The documentation grew one page at a time, so the tree follows the
history of who wrote what and not the shape of NuttX. Scheduling is
spread over three places, a driver page can sit above the subsystem
that owns it, and the front page lists everything at the same level.
That is a lot to face when all you want to know is where the scheduler
lives.

This change files every page under the code it describes. It is a move,
not a rewrite: outside the ten pages named below, every page keeps the
text that is already in master, and no page's text is deleted.

What it does:

* Groups the table of contents into nine chapters.
* Moves the OS subsystems under os/: scheduling, memory, drivers,
  filesystem, networking, IPC, interrupts, libs, time.
* Renames the platform pages to the names the source tree uses, and
  derives their tags from the tree instead of by hand.
* Splits guides/ by subject.
* Adds Documentation/redirects.py, with a rule for every page that left
  its old path, so old URLs keep working. The redirect page also carries
  a link's #anchor across to the new page.

Ten pages have text that is new or rewritten. Nine of them are the
landing page of a chapter, which has to exist for the new structure:

    index                  the front page
    os/index               OS Design
    os/scheduling/index    Scheduling
    os/interrupts/index    Interrupts
    os/ipc/index           IPC
    os/time/index          Time and timers
    about/index            About
    developing/index       Developing NuttX
    ReleaseNotes/index     Release notes

The tenth is os/libs/libbuiltin, the only page here with technical
content: libs/libbuiltin/ had no page at all. Five SVG diagrams come
with these pages, hand-written XML with no editor metadata.

Nothing outside Documentation/ is touched.

How it was checked:

* Sphinx builds with -W: no warnings, and no document left outside a
  toctree.
* A script, offered in the PR, proves the narrow claim this rests on.
  For every page outside the ten named above it erases what a move
  touches -- link target, path, tag line, toctree block, table border --
  from the whole old text and the whole new text, and requires the two
  to be byte for byte identical. It also requires every sentence of a
  deleted page to turn up somewhere, and every page that left its old
  path to have a redirect, from a URL that existed, to where its content
  went. It exits non-zero and names the page if any of that is not true,
  and it tests added pages too, so forgetting to declare one cannot make
  it pass.
* An independent audit checked 133 factual claims on these ten pages
  against the tree, one shell command per claim: 130 confirmed, 1
  refuted and fixed here, 2 not checkable.
* tools/checkpatch.sh is clean over the range.

The diff is large because moving a page changes every link that points
to it. Most of it is pure renames, and board pages that gained one tag
line.

Assisted-by: Claude:claude-opus-5
2026-10-08 01:40:54 +08:00

65 lines
2.5 KiB
ReStructuredText

=================
Open Flash Loader
=================
Introduce
=========
Open Flash loader is an implementation in NuttX that bridges the device
drivers in NuttX with the programming methods of a flash loader in J-Link.
It allows J-Link to program any supported NuttX device driver.
CONFIGURATION
===============
.. code-block:: c
CONFIG_DISABLE_IDLE_LOOP=y
CONFIG_SYSTEM_OFLOADER=y
CONFIG_SYSTEM_OFLOADER_TABLE="/dev/flash,0x08000000,0x20000",0
```CONFIG_DISABLE_IDLE_LOOP`` is used to disable the idle loop in NuttX.
```CONFIG_SYSTEM_OFLOADER``` is used to enable the Open Flash Loader.
```CONFIG_SYSTEM_OFLOADER_TABLE``` is used to configure the flash device
first parameter is the device name, second parameter is the start address.
The reference configuration "stm32f429i-disco:ofloader" is designed
to be used with the STM32F429I-DISCO board in NuttX,
enabling the Open Flash loader functionality. This configuration allows
the J-Link flash loader to program the NuttX image onto the STM32F429I-DISCO board.
Usage
=====
1. Build NuttX with Open Flash Loader.
2. Configure the Jlink xml file. like
.. code-block:: xml
<Database>
<Device>
<ChipInfo Vendor="STM32NUTTX" Name="NuttX" Core="JLINK_CORE_CORTEX_M4" WorkRAMAddr="0x20000000" WorkRAMSize="0x10000000" />
<FlashBankInfo Name="Storage" BaseAddr="0x00000000" MaxSize="0xffffffff" Loader="/home/ajh/work/vela_all/nuttx/nuttx" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
</Device>
</Database>
3. Use ``JLinkExe -if SWD -speed 4000 -device STM32NUTTX``,
then ``loadbin /home/ajh/work/nuttx.bin 0x08000000``,
we can flash nuttx.bin to /dev/flash
Precautions
===========
1.If you need to implement the ofloader on a different board,
you will need to read the `wiki <https://wiki.segger.com/SEGGER_Flash_Loader>`
and refer to the implementation of "ofloader.ld" linker script located
in the "boards/arm/stm32f4/stm32f429i-disco/scripts" directory.
This linker script defines how the different sections of the NuttX image are placed in memory.
You should configure the corresponding sections to be located in RAM,
where the J-Link can write the image correctly.
2.When running the ofloader, J-Link disables any interrupts by default.
Therefore, currently, it does not support programming devices with interrupt-driven drivers.
3.Due to limitations of J-Link, the ofloader image file cannot exceed 64KB.
It is essential to be mindful of this constraint during programming.