MCPcopy Create free account
hub / github.com/apache/nuttx / main

Function main

tools/mkconfig.c:60–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 ****************************************************************************/
59
60int main(int argc, char **argv, char **envp)
61{
62 char *filepath;
63 FILE *stream;
64
65 if (argc != 2)
66 {
67 fprintf(stderr, "Unexpected number of arguments\n");
68 show_usage(argv[0]);
69 }
70
71 filepath = getfilepath(argv[1]);
72 if (!filepath)
73 {
74 fprintf(stderr, "getfilepath failed\n");
75 exit(2);
76 }
77
78 stream = fopen(filepath, "r");
79 if (!stream)
80 {
81 fprintf(stderr, "open %s failed: %s\n", filepath, strerror(errno));
82 exit(3);
83 }
84
85 printf(
86 "/* config.h -- Autogenerated! Do not edit. */\n\n"
87 "#ifndef __INCLUDE_NUTTX_CONFIG_H\n"
88 "#define __INCLUDE_NUTTX_CONFIG_H\n\n"
89 "/* Used to represent the values of tristate options */\n\n"
90 "#define CONFIG_y 1\n"
91 "#define CONFIG_m 2\n\n"
92 "/* General Definitions ***********************************/\n");
93
94 generate_definitions(stream);
95
96 printf(
97 "\n/* Sanity Checks *****************************************/\n\n"
98 "/* If the end of RAM is not specified then it is assumed to be\n"
99 " * the beginning of RAM plus the RAM size.\n"
100 " */\n\n"
101 "#ifndef CONFIG_RAM_END\n"
102 "# define CONFIG_RAM_END (CONFIG_RAM_START+CONFIG_RAM_SIZE)\n"
103 "#endif\n\n"
104 "#ifndef CONFIG_RAM_VEND\n"
105 "# define CONFIG_RAM_VEND (CONFIG_RAM_VSTART+CONFIG_RAM_SIZE)\n"
106 "#endif\n\n"
107 "/* If the end of FLASH is not specified then it is assumed to be\n"
108 " * the beginning of FLASH plus the FLASH size.\n"
109 " */\n\n"
110 "#ifndef CONFIG_FLASH_END\n"
111 "# define CONFIG_FLASH_END (CONFIG_FLASH_START+CONFIG_FLASH_SIZE)\n"
112 "#endif\n\n"
113 "#endif /* __INCLUDE_NUTTX_CONFIG_H */\n");
114
115 fclose(stream);
116
117 /* Exit (without bothering to clean up allocations) */

Callers

nothing calls this directly

Calls 10

fprintfFunction · 0.85
exitFunction · 0.85
fopenFunction · 0.85
strerrorFunction · 0.85
printfFunction · 0.85
generate_definitionsFunction · 0.85
fcloseFunction · 0.85
show_usageFunction · 0.70
getfilepathFunction · 0.70
freeFunction · 0.50

Tested by

no test coverage detected