MCPcopy Create free account
hub / github.com/kiibohd/controller / parse_options

Function parse_options

LoadFile/teensy_loader_cli.c:843–889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

841#endif
842
843void parse_options(int argc, char **argv)
844{
845 int i;
846 const char *arg;
847
848 for (i=1; i<argc; i++) {
849 arg = argv[i];
850 //printf("arg: %s\n", arg);
851 if (*arg == '-') {
852 if (strcmp(arg, "-w") == 0) {
853 wait_for_device_to_appear = 1;
854 } else if (strcmp(arg, "-r") == 0) {
855 hard_reboot_device = 1;
856 } else if (strcmp(arg, "-n") == 0) {
857 reboot_after_programming = 0;
858 } else if (strcmp(arg, "-v") == 0) {
859 verbose = 1;
860 } else if (strncmp(arg, "-mmcu=", 6) == 0) {
861 if (strcasecmp(arg+6, "at90usb162") == 0) {
862 code_size = 15872;
863 block_size = 128;
864 } else if (strcasecmp(arg+6, "atmega32u4") == 0) {
865 code_size = 32256;
866 block_size = 128;
867 } else if (strcasecmp(arg+6, "at90usb646") == 0) {
868 code_size = 64512;
869 block_size = 256;
870 } else if (strcasecmp(arg+6, "at90usb1286") == 0) {
871 code_size = 130048;
872 block_size = 256;
873#if defined(USE_LIBUSB)
874 } else if (strcasecmp(arg+6, "mk20dx128") == 0) {
875 code_size = 131072;
876 block_size = 1024;
877 } else if (strcasecmp(arg+6, "mk20dx256") == 0) {
878 code_size = 262144;
879 block_size = 1024;
880#endif
881 } else {
882 die("Unknown MCU type\n");
883 }
884 }
885 } else {
886 filename = argv[i];
887 }
888 }
889}
890

Callers 1

mainFunction · 0.85

Calls 1

dieFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…