Changeset 331 for EcnlProtoTool/trunk/prototool/src/main.c
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/prototool/src/main.c
r321 r331 49 49 #include <netdb.h> 50 50 #include <unistd.h> 51 #include <setjmp.h>52 51 #include <signal.h> 53 52 #include <time.h> 54 53 #include <sys/time.h> 55 #include < sys/unistd.h>54 #include <unistd.h> 56 55 #include <errno.h> 57 56 … … 65 64 #include <mruby/dump.h> 66 65 #include <mruby/string.h> 67 #include < usrcmd.h>66 #include <ntshell/usrcmd.h> 68 67 69 68 #define ETHER_MAX_LEN 1518 … … 89 88 extern int mruby_main(int argc, char **argv); 90 89 extern int mirb_main(int argc, char **argv); 90 extern int curl_main(int argc, char **argv); 91 91 extern int tcc_main(int argc, char **argv); 92 92 extern int vi_main(int argc, char **argv); … … 101 101 {"mruby","mruby command", mruby_main}, 102 102 {"mirb", "Embeddable Interactive Ruby Shell", mirb_main}, 103 {"curl", "Command lines or scripts to transfer data", curl_main}, 103 104 {"tcc", "Tiny C compiler", tcc_main}, 104 105 {"vi", "Text editor", vi_main}, 105 {"cd", "change directory", usrcmd_cd },106 {"ls", "list files", usrcmd_ls },107 {"cp", "copy file", usrcmd_cp },108 {"rm", "remove file", usrcmd_rm },109 {"mv", "move file", usrcmd_mv },110 {"mkdir", "Make directory", usrcmd_mkdir},111 {"hexdump", "Hex dump", usrcmd_hexdump},112 106 {"onitest", "Onigumo Test", onitest_main}, 113 107 {"tcp_echo", "TCP echo server/client", tcp_echo_main}, 114 108 {"help", "This is a description text string for help command.", usrcmd_help}, 115 {"info", "This is a description text string for info command.", usrcmd_info},116 {"exit", "Exit Natural Tyny Shell", usrcmd_exit},117 109 }; 118 110 cmd_table_info_t cmd_table_info = { &cmdlist, sizeof(cmdlist) / sizeof(cmdlist[0]) }; … … 521 513 } 522 514 523 // Provide implementation of _sbrk (low-level dynamic memory allocation 524 // routine) for GCC_ARM which compares new heap pointer with MSP instead of 525 // SP. This make it compatible with RTX RTOS thread stacks. 526 527 // Linker defined symbol used by _sbrk to indicate where heap should start. 528 int _end; 529 uint32_t _stack; 530 531 // Turn off the errno macro and use actual global variable instead. 532 #undef errno 533 int errno; 534 535 static unsigned char* heap = (unsigned char*)&_end; 536 537 // Dynamic memory allocation related syscall. 538 caddr_t _sbrk(int incr) { 539 unsigned char* prev_heap = heap; 540 unsigned char* new_heap = heap + incr; 541 542 if (new_heap >= (unsigned char*)&_stack) { /* _stack is end of heap section */ 543 errno = ENOMEM; 544 return (caddr_t)-1; 545 } 546 547 heap = new_heap; 548 return (caddr_t) prev_heap; 549 } 550 551 char *optarg; 515 void _start_c(long *p); 552 516 int _data, _mdata, _edata; 553 517 int _bss, _ebss; 554 518 555 int _PowerON_Reset(int argc, char **argv)519 void _PowerON_Reset(long *args) 556 520 { 557 521 memcpy(&_data, &_mdata, (size_t)&_edata - (size_t)&_data); 558 522 memset(&_bss, 0, (size_t)&_ebss - (size_t)&_bss); 559 523 560 optarg = *argv; 561 return main(argc, argv); 524 _start_c(args); 562 525 } 563 526
Note:
See TracChangeset
for help on using the changeset viewer.