Skip to content

Commit 71bcf47

Browse files
committed
Formatting fixes for the C files
1 parent e387f58 commit 71bcf47

File tree

2 files changed

+314
-334
lines changed

2 files changed

+314
-334
lines changed

tensorflow/lite/experimental/micro/examples/micro_speech/apollo3/_main.c

Lines changed: 91 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -14,110 +14,104 @@ limitations under the License.
1414
==============================================================================*/
1515

1616
#include <stdint.h>
17-
#include "am_mcu_apollo.h" // Defines AM_CMSIS_REGS
1817
#include "am_bsp.h"
18+
#include "am_mcu_apollo.h" // Defines AM_CMSIS_REGS
1919
#include "am_util.h"
2020

2121
//*****************************************************************************
2222
//
2323
// The entry point for the application.
2424
//
2525
//*****************************************************************************
26-
extern int main(int argc, char**argv);
27-
28-
void DebugLog(const char* s) { am_util_stdio_printf( "%s", s); }
29-
void DebugLogInt32(int32_t i) { am_util_stdio_printf( "%d", i); }
30-
void DebugLogUInt32(uint32_t i) { am_util_stdio_printf( "%d", i); }
31-
void DebugLogHex(uint32_t i) { am_util_stdio_printf( "0x%8x", i); }
32-
void DebugLogFloat(float i) { am_util_stdio_printf( "%f", i); }
33-
34-
int _main(void)
35-
{
36-
am_util_id_t sIdDevice;
37-
uint32_t ui32StrBuf;
38-
39-
//
40-
// Set the clock frequency.
41-
//
42-
am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_SYSCLK_MAX, 0);
43-
44-
//
45-
// Set the default cache configuration
46-
//
47-
am_hal_cachectrl_config(&am_hal_cachectrl_defaults);
48-
am_hal_cachectrl_enable();
49-
50-
//
51-
// Configure the board for low power operation.
52-
//
53-
am_bsp_low_power_init();
54-
55-
//
56-
// Initialize the printf interface for UART output
57-
//
58-
am_bsp_uart_printf_enable();
59-
60-
//
61-
// Print the banner.
62-
//
63-
am_util_stdio_terminal_clear();
64-
am_util_stdio_printf("Hello World!\n\n");
65-
66-
//
67-
// Print the device info.
68-
//
69-
am_util_id_device(&sIdDevice);
70-
am_util_stdio_printf("Vendor Name: %s\n", sIdDevice.pui8VendorName);
71-
am_util_stdio_printf("Device type: %s\n", sIdDevice.pui8DeviceName);
72-
73-
74-
am_util_stdio_printf("Qualified: %s\n",
75-
sIdDevice.sMcuCtrlDevice.ui32Qualified ?
76-
"Yes" : "No");
77-
78-
am_util_stdio_printf("Device Info:\n"
79-
"\tPart number: 0x%08X\n"
80-
"\tChip ID0: 0x%08X\n"
81-
"\tChip ID1: 0x%08X\n"
82-
"\tRevision: 0x%08X (Rev%c%c)\n",
83-
sIdDevice.sMcuCtrlDevice.ui32ChipPN,
84-
sIdDevice.sMcuCtrlDevice.ui32ChipID0,
85-
sIdDevice.sMcuCtrlDevice.ui32ChipID1,
86-
sIdDevice.sMcuCtrlDevice.ui32ChipRev,
87-
sIdDevice.ui8ChipRevMaj, sIdDevice.ui8ChipRevMin );
88-
89-
//
90-
// If not a multiple of 1024 bytes, append a plus sign to the KB.
91-
//
92-
ui32StrBuf = ( sIdDevice.sMcuCtrlDevice.ui32FlashSize % 1024 ) ? '+' : 0;
93-
am_util_stdio_printf("\tFlash size: %7d (%d KB%s)\n",
94-
sIdDevice.sMcuCtrlDevice.ui32FlashSize,
95-
sIdDevice.sMcuCtrlDevice.ui32FlashSize / 1024,
96-
&ui32StrBuf);
97-
98-
ui32StrBuf = ( sIdDevice.sMcuCtrlDevice.ui32SRAMSize % 1024 ) ? '+' : 0;
99-
am_util_stdio_printf("\tSRAM size: %7d (%d KB%s)\n\n",
100-
sIdDevice.sMcuCtrlDevice.ui32SRAMSize,
101-
sIdDevice.sMcuCtrlDevice.ui32SRAMSize / 1024,
102-
&ui32StrBuf);
103-
104-
//
105-
// Print the compiler version.
106-
//
107-
am_util_stdio_printf("App Compiler: %s\n", COMPILER_VERSION);
26+
extern int main(int argc, char** argv);
27+
28+
void DebugLog(const char* s) { am_util_stdio_printf("%s", s); }
29+
void DebugLogInt32(int32_t i) { am_util_stdio_printf("%d", i); }
30+
void DebugLogUInt32(uint32_t i) { am_util_stdio_printf("%d", i); }
31+
void DebugLogHex(uint32_t i) { am_util_stdio_printf("0x%8x", i); }
32+
void DebugLogFloat(float i) { am_util_stdio_printf("%f", i); }
33+
34+
int _main(void) {
35+
am_util_id_t sIdDevice;
36+
uint32_t ui32StrBuf;
37+
38+
//
39+
// Set the clock frequency.
40+
//
41+
am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_SYSCLK_MAX, 0);
42+
43+
//
44+
// Set the default cache configuration
45+
//
46+
am_hal_cachectrl_config(&am_hal_cachectrl_defaults);
47+
am_hal_cachectrl_enable();
48+
49+
//
50+
// Configure the board for low power operation.
51+
//
52+
am_bsp_low_power_init();
53+
54+
//
55+
// Initialize the printf interface for UART output
56+
//
57+
am_bsp_uart_printf_enable();
58+
59+
//
60+
// Print the banner.
61+
//
62+
am_util_stdio_terminal_clear();
63+
am_util_stdio_printf("Hello World!\n\n");
64+
65+
//
66+
// Print the device info.
67+
//
68+
am_util_id_device(&sIdDevice);
69+
am_util_stdio_printf("Vendor Name: %s\n", sIdDevice.pui8VendorName);
70+
am_util_stdio_printf("Device type: %s\n", sIdDevice.pui8DeviceName);
71+
72+
am_util_stdio_printf("Qualified: %s\n",
73+
sIdDevice.sMcuCtrlDevice.ui32Qualified ? "Yes" : "No");
74+
75+
am_util_stdio_printf(
76+
"Device Info:\n"
77+
"\tPart number: 0x%08X\n"
78+
"\tChip ID0: 0x%08X\n"
79+
"\tChip ID1: 0x%08X\n"
80+
"\tRevision: 0x%08X (Rev%c%c)\n",
81+
sIdDevice.sMcuCtrlDevice.ui32ChipPN, sIdDevice.sMcuCtrlDevice.ui32ChipID0,
82+
sIdDevice.sMcuCtrlDevice.ui32ChipID1,
83+
sIdDevice.sMcuCtrlDevice.ui32ChipRev, sIdDevice.ui8ChipRevMaj,
84+
sIdDevice.ui8ChipRevMin);
85+
86+
//
87+
// If not a multiple of 1024 bytes, append a plus sign to the KB.
88+
//
89+
ui32StrBuf = (sIdDevice.sMcuCtrlDevice.ui32FlashSize % 1024) ? '+' : 0;
90+
am_util_stdio_printf(
91+
"\tFlash size: %7d (%d KB%s)\n", sIdDevice.sMcuCtrlDevice.ui32FlashSize,
92+
sIdDevice.sMcuCtrlDevice.ui32FlashSize / 1024, &ui32StrBuf);
93+
94+
ui32StrBuf = (sIdDevice.sMcuCtrlDevice.ui32SRAMSize % 1024) ? '+' : 0;
95+
am_util_stdio_printf(
96+
"\tSRAM size: %7d (%d KB%s)\n\n", sIdDevice.sMcuCtrlDevice.ui32SRAMSize,
97+
sIdDevice.sMcuCtrlDevice.ui32SRAMSize / 1024, &ui32StrBuf);
98+
99+
//
100+
// Print the compiler version.
101+
//
102+
am_util_stdio_printf("App Compiler: %s\n", COMPILER_VERSION);
108103
#ifdef AM_PART_APOLLO3
109-
am_util_stdio_printf("HAL Compiler: %s\n", g_ui8HALcompiler);
110-
am_util_stdio_printf("HAL SDK version: %d.%d.%d\n",
111-
g_ui32HALversion.s.Major,
112-
g_ui32HALversion.s.Minor,
113-
g_ui32HALversion.s.Revision);
114-
am_util_stdio_printf("HAL compiled with %s-style registers\n",
115-
g_ui32HALversion.s.bAMREGS ? "AM_REG" : "CMSIS");
116-
117-
am_util_stdio_printf("&sIdDevice: 0x%x, &ui32StrBuf: 0x%x\n", &sIdDevice, &ui32StrBuf);
118-
am_hal_security_info_t secInfo;
119-
char sINFO[32];
120-
uint32_t ui32Status;
121-
#endif // AM_PART_APOLLO3
122-
main(0, NULL);
104+
am_util_stdio_printf("HAL Compiler: %s\n", g_ui8HALcompiler);
105+
am_util_stdio_printf("HAL SDK version: %d.%d.%d\n", g_ui32HALversion.s.Major,
106+
g_ui32HALversion.s.Minor, g_ui32HALversion.s.Revision);
107+
am_util_stdio_printf("HAL compiled with %s-style registers\n",
108+
g_ui32HALversion.s.bAMREGS ? "AM_REG" : "CMSIS");
109+
110+
am_util_stdio_printf("&sIdDevice: 0x%x, &ui32StrBuf: 0x%x\n", &sIdDevice,
111+
&ui32StrBuf);
112+
am_hal_security_info_t secInfo;
113+
char sINFO[32];
114+
uint32_t ui32Status;
115+
#endif // AM_PART_APOLLO3
116+
main(0, NULL);
123117
}

0 commit comments

Comments
 (0)