Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flashmap: Add support for linker script generation #537

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions newt/flashmap/flashmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,15 @@ func writeFlashMapHeader(w io.Writer, fm FlashMap) {
fmt.Fprintf(w, "#ifndef H_MYNEWT_SYSFLASH_\n")
fmt.Fprintf(w, "#define H_MYNEWT_SYSFLASH_\n")
fmt.Fprintf(w, "\n")
fmt.Fprintf(w, "#include \"flash_map/flash_map.h\"\n")
fmt.Fprintf(w, "\n")
fmt.Fprintf(w, "#define FLASH_AREA_COUNT %d\n", len(fm.Areas))
fmt.Fprintf(w, "\n")
fmt.Fprintf(w, "/* MYNEWT_SYSFLASH_ONLY_CONST is defined when this header is used for linker script generation */\n")
fmt.Fprintf(w, "#ifndef MYNEWT_SYSFLASH_ONLY_CONST\n")
fmt.Fprintf(w, "#include \"flash_map/flash_map.h\"\n")
fmt.Fprintf(w, "\n")
fmt.Fprintf(w, "%s", C_VAR_COMMENT)
fmt.Fprintf(w, "extern %s;\n", flashMapVarDecl(fm))
fmt.Fprintf(w, "#endif\n")
fmt.Fprintf(w, "\n")
fmt.Fprintf(w, "/* Flash map was defined in %s */\n", fm.PkgName)
fmt.Fprintf(w, "\n")
Expand Down
Loading