1# Bootloader override
2
3(See the README.md file in the upper level for more information about bootloader examples.)
4
5The purpose of this example is to show how to override the second stage bootloader from a regular project.
6
7**NOTE**: Overriding the bootloader is not supported with `Makefile` build system, it is only available with `CMake`.
8
9## How to use example
10
11Simply compile it:
12```
13idf.py build
14```
15
16And flash it with the following commands:
17```
18idf.py flash
19```
20
21This custom bootloader does not do more than the older bootloader, it only prints an extra message on start up:
22```
23[boot] Custom bootloader has been initialized correctly.
24```
25
26## Organisation of this example
27
28This project contains an application, in the `main` directory that represents a user program.
29It also contains a `bootloader_components` directory that, as it name states, contains a component that will override the current bootloader implementation.
30
31Below is a short explanation of files in the project folder.
32
33```
34├── CMakeLists.txt
35├── main
36│   ├── CMakeLists.txt
37│   └── main.c                 User application
38├── bootloader_components
39│   └── main
40│       ├── component.mk
41│       ├── CMakeLists.txt
42│       ├── ld/
43│       │   └── ...
44│       └── bootloader_start.c Implementation of the second stage bootloader
45└── README.md                  This is the file you are currently reading
46```
47
48As stated in the `README.md` file in the upper level, when the bootloader components is named `main`, it overrides
49the whole second stage bootloader code.
50