Skip to content

Commit

Permalink
Update samples to use mynewt_main instead of main
Browse files Browse the repository at this point in the history
Mynewt core was updated to use mynewt_main.
  • Loading branch information
sjanc committed Sep 25, 2023
1 parent 61e724a commit acc3ee9
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 102 deletions.
2 changes: 1 addition & 1 deletion apps/advertiser/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ on_reset(int reason)
}

int
main(int argc, char **argv)
mynewt_main(int argc, char **argv)
{
int rc;

Expand Down
17 changes: 2 additions & 15 deletions apps/blecent/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ blecent_on_sync(void)
*
* @return int NOTE: this function should never return!
*/
static int
main_fn(int argc, char **argv)
int
mynewt_main(int argc, char **argv)
{
int rc;

Expand All @@ -523,16 +523,3 @@ main_fn(int argc, char **argv)

return 0;
}

int
main(int argc, char **argv)
{
#if BABBLESIM
extern void bsim_init(int argc, char** argv, void *main_fn);
bsim_init(argc, argv, main_fn);
#else
main_fn(argc, argv);
#endif

return 0;
}
2 changes: 1 addition & 1 deletion apps/blecsc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ blecsc_on_sync(void)
* @return int NOTE: this function should never return!
*/
int
main(void)
mynewt_main(int argc, char **argv)
{
int rc;

Expand Down
17 changes: 2 additions & 15 deletions apps/blehci/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "os/mynewt.h"

static int
main_fn(int argc, char **argv)
int
mynewt_main(int argc, char **argv)
{
/* Initialize OS */
sysinit();
Expand All @@ -30,16 +30,3 @@ main_fn(int argc, char **argv)
}
return 0;
}

int
main(int argc, char **argv)
{
#if BABBLESIM
extern void bsim_init(int argc, char** argv, void *main_fn);
bsim_init(argc, argv, main_fn);
#else
main_fn(argc, argv);
#endif

return 0;
}
2 changes: 1 addition & 1 deletion apps/blehr/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ blehr_on_sync(void)
* @return int NOTE: this function should never return!
*/
int
main(void)
mynewt_main(int argc, char **argv)
{
int rc;

Expand Down
7 changes: 1 addition & 6 deletions apps/blemesh/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,8 @@ blemesh_on_sync(void)
}

int
main(int argc, char **argv)
mynewt_main(int argc, char **argv)
{

#ifdef ARCH_sim
mcu_sim_parse_args(argc, argv);
#endif

/* Initialize OS */
sysinit();

Expand Down
2 changes: 1 addition & 1 deletion apps/blemesh_light/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ blemesh_on_sync(void)
}

int
main(void)
mynewt_main(int argc, char **argv)
{
/* Initialize OS */
sysinit();
Expand Down
7 changes: 2 additions & 5 deletions apps/blemesh_models_example_1/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,12 +652,9 @@ blemesh_on_sync(void)
console_printf("Mesh initialized\n");
}

int main(void)
int
mynewt_main(int argc, char **argv)
{
#ifdef ARCH_sim
mcu_sim_parse_args(argc, argv);
#endif

/* Initialize OS */
sysinit();

Expand Down
7 changes: 2 additions & 5 deletions apps/blemesh_models_example_2/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,9 @@ void bt_initialized(void)
short_time_multireset_bt_mesh_unprovisioning();
}

int main(void)
int
mynewt_main(int argc, char **argv)
{
#ifdef ARCH_sim
mcu_sim_parse_args(argc, argv);
#endif

/* Initialize OS */
sysinit();

Expand Down
2 changes: 1 addition & 1 deletion apps/blemesh_shell/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ blemesh_on_sync(void)
}

int
main(void)
mynewt_main(int argc, char **argv)
{
/* Initialize OS */
sysinit();
Expand Down
17 changes: 2 additions & 15 deletions apps/bleprph/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ bleprph_on_sync(void)
*
* @return int NOTE: this function should never return!
*/
static int
main_fn(int argc, char **argv)
int
mynewt_main(int argc, char **argv)
{
#if MYNEWT_VAL(BLE_SVC_DIS_FIRMWARE_REVISION_READ_PERM) >= 0
struct image_version ver;
Expand Down Expand Up @@ -357,16 +357,3 @@ main_fn(int argc, char **argv)
}
return 0;
}

int
main(int argc, char **argv)
{
#if BABBLESIM
extern void bsim_init(int argc, char** argv, void *main_fn);
bsim_init(argc, argv, main_fn);
#else
main_fn(argc, argv);
#endif

return 0;
}
2 changes: 1 addition & 1 deletion apps/blestress/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ stress_test_on_sync(void)
* @return int NOTE: this function should never return!
*/
int
main(void)
mynewt_main(int argc, char **argv)
{
int rc;

Expand Down
21 changes: 2 additions & 19 deletions apps/btshell/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2626,15 +2626,11 @@ btshell_get_default_own_addr_type(void)
*
* @return int NOTE: this function should never return!
*/
static int
main_fn(int argc, char **argv)
int
mynewt_main(int argc, char **argv)
{
int rc;

#ifdef ARCH_sim
mcu_sim_parse_args(argc, argv);
#endif

/* Initialize OS */
sysinit();

Expand Down Expand Up @@ -2703,16 +2699,3 @@ main_fn(int argc, char **argv)

return 0;
}

int
main(int argc, char **argv)
{
#if BABBLESIM
extern void bsim_init(int argc, char** argv, void *main_fn);
bsim_init(argc, argv, main_fn);
#else
main_fn(argc, argv);
#endif

return 0;
}
6 changes: 1 addition & 5 deletions apps/bttester/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,10 @@ on_sync(void)
}

int
main(int argc, char **argv)
mynewt_main(int argc, char **argv)
{
int rc;

#ifdef ARCH_sim
mcu_sim_parse_args(argc, argv);
#endif

/* Initialize OS */
sysinit();

Expand Down
2 changes: 1 addition & 1 deletion apps/central/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ on_reset(int reason)
}

int
main(int argc, char **argv)
mynewt_main(int argc, char **argv)
{
/* Initialize all packages. */
sysinit();
Expand Down
2 changes: 1 addition & 1 deletion apps/dtm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ on_reset(int reason)
}

int
main(void)
mynewt_main(int argc, char **argv)
{
struct image_version the_version;
char prompt[50];
Expand Down
2 changes: 1 addition & 1 deletion apps/ext_advertiser/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ on_sync(void)
* @return int NOTE: this function should never return!
*/
int
main(void)
mynewt_main(int argc, char **argv)
{
/* Initialize OS */
sysinit();
Expand Down
3 changes: 2 additions & 1 deletion apps/mesh_badge/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ int bt_set_name(const char *name)
return 0;
}

int main(void)
int
mynewt_main(int argc, char **argv)
{
int err;

Expand Down
2 changes: 1 addition & 1 deletion apps/peripheral/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ on_reset(int reason)
}

int
main(int argc, char **argv)
mynewt_main(int argc, char **argv)
{
int rc;

Expand Down
2 changes: 1 addition & 1 deletion apps/scanner/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ on_reset(int reason)
}

int
main(int argc, char **argv)
mynewt_main(int argc, char **argv)
{
/* Initialize all packages. */
sysinit();
Expand Down
4 changes: 2 additions & 2 deletions babblesim/core/src/main_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ main_clean_up_trace_wrap(void)
}

void
bsim_init(int argc, char** argv, int (*main_fn)(int argc, char **arg))
main(int argc, char** argv)
{
setvbuf(stdout, NULL, _IOLBF, 512);
setvbuf(stderr, NULL, _IOLBF, 512);
Expand All @@ -64,7 +64,7 @@ bsim_init(int argc, char** argv, int (*main_fn)(int argc, char **arg))
bs_read_function_names_from_Tsymbols(argv[0]);

nrf_hw_initialize(&args->nrf_hw);
os_init(main_fn);
os_init(mynewt_main);
os_start();

while (1) {
Expand Down
2 changes: 0 additions & 2 deletions babblesim/hw/mcu/nordic/nrf52_bsim/include/mcu/mcu_sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ extern char *native_flash_file;
extern char *native_uart_log_file;
extern const char *native_uart_dev_strs[];

void mcu_sim_parse_args(int argc, char **argv);

void static inline hal_debug_break(void) {}

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion docs/ble_setup/ble_sync_cb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ reset callbacks.
}
int
main(void)
mynewt_main(int argc, char **argv)
{
/* Initialize all packages. */
sysinit();
Expand Down

0 comments on commit acc3ee9

Please sign in to comment.