Skip to content

Commit

Permalink
doc: add more notes and warning for code and doc
Browse files Browse the repository at this point in the history
Signed-off-by: Huaqi Fang <[email protected]>
  • Loading branch information
fanghuaqi committed Dec 6, 2024
1 parent e704497 commit 8c26996
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ The flash loader(loader/loader.c) binary will ``loader_main`` with parameters pa
**The following environment must be setuped**

- **Nuclei Studio Version >= 2024.02**, which contains prebuilt gcc and openocd
- Don't use any global variables.(**Warning**)

> [!WARNING]
- **WARNING** Don't use any global variables in flashloader implementation source code.

### Flash Driver API

Expand Down Expand Up @@ -87,7 +90,7 @@ Initialize nuspi, read flash ID and return the flash ID.
**Return values**
Flash ID(**Warning**)
Flash ID
#### flash_erase
Expand Down
2 changes: 2 additions & 0 deletions flash/w25q256fv.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "flash.h"
#include "spi.h"

/* WARNING: NEVER USE GLOBAL VARIABLE IN THIS FILE */

/*==== FLASH ====*/
#define SPIFLASH_BSY 0
#define SPIFLASH_BSY_BIT (1 << SPIFLASH_BSY) /* WIP Bit of SPI SR */
Expand Down
2 changes: 2 additions & 0 deletions loader/loader.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "flash.h"

/* WARNING: NEVER USE GLOBAL VARIABLE IN THIS FILE */

/*==== Loader ====*/
#define ERASE_CMD (1)
#define WRITE_CMD (2)
Expand Down
2 changes: 2 additions & 0 deletions spi/fespi.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "spi.h"

/* WARNING: NEVER USE GLOBAL VARIABLE IN THIS FILE */

/* Register offsets */
#define FESPI_REG_SCKMODE (0x04)
#define FESPI_REG_FORCE (0x0C)
Expand Down
2 changes: 2 additions & 0 deletions spi/nuspi.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "spi.h"

/* WARNING: NEVER USE GLOBAL VARIABLE IN THIS FILE */

/* Register offsets */
#define NUSPI_REG_SCKMODE (0x04)
#define NUSPI_REG_FORCE (0x0C)
Expand Down
2 changes: 2 additions & 0 deletions test/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <stdio.h>
#include <stdint.h>

/* NOTE: THIS TEST CODE IS USED WITH NUCLEI SDK */

#define DEBUG_INFO (1)

/*==== Loader ====*/
Expand Down

0 comments on commit 8c26996

Please sign in to comment.