Ejemplo n.º 1
0
void _unlzma_veneer(){
	uart_write('D'); uart_write(' ');
	int res = unlzma((uint8_t *)code, (uint8_t *)SYSMEM_BASE, 16384);
	if(res != 0) error_loop();
//	uart_write('S'); uart_write(' ');
	long_jump_to_start();
}
Ejemplo n.º 2
0
Archivo: tpico.c Proyecto: aropop/pico
int main(int argc, char *argv[])
{
   int i, j, doubledash = 0;
   char *mem, *line, *last = NULL;
   struct stat instat;

   (void)fstat(0,&instat);  /* XXX */
   if (S_ISCHR(instat.st_mode))
      chardev = 1;
   if (S_ISSOCK(instat.st_mode))
      sockdev = 1;

   for (i=1; i<argc; i++)
      if (argv[i][0] == '-') {
         if (argv[i][1] == '-' && !argv[i][2])
            break;
         for (j=1; argv[i][j]; j++)
            switch (argv[i][j]) {
               case 'b': banner=0; break;
               case 'i': input=0; break;
               case 'c': garbage=1; break;
               case 'h': help=1; break;
               case 's': standalone=1; break;
               default:  sprintf(sprintfbuf,
                               "Unknown command line option: %s\n",
                               argv[i]); 
                         show(sprintfbuf,ON_NEW_LINE);
                         cleanup_exit(EXIT_FAILURE);
            }
      }

   if ((mem = (char *)malloc(MEMSIZE)) == NULL) {
      sprintf(sprintfbuf,
              "FATAL ERROR: Cannot allocate %d bytes for the Virtual Machine\n",
              MEMSIZE);
      show(sprintfbuf, ON_NEW_LINE);
      exit(EXIT_FAILURE);
   }

   if (banner)
      show("Welcome to TextPico 1.0\n\n", ON_OLD_LINE);
   if (help) {
      show ("-b: show no opening banner\n"
            "-c: print a message during garbage collection\n"
            "-h: help\n"
            "-i: no interactive session: only process file arguments\n"
	    "-s: ignore #!-line to allow stand-alone executables\n",
            ON_OLD_LINE);
      exit(EXIT_SUCCESS);
   }

   (void)_PICO_INIT_(mem, MEMSIZE);
   assert(!_PICO_SESSION_(1));

   (void)signal(SIGINT, abrt);

   (void)signal(SIGSEGV, segv); 
   (void)signal(SIGILL, ill);
   (void)signal(SIGFPE, fpe);
 
   for (i=1; i< argc; i++) {
      if (argv[i][0] == '-' && !argv[i][1]) {
         show("ERROR: Tpico does not support \"-\" syntax", ON_NEW_LINE);
         continue;
      }
      if (argv[i][0] == '-' && argv[i][1] == '-' && !argv[i][2]) {
         doubledash = 1;
         continue;
      }
      if (argv[i][0] == '-' && !doubledash)
         continue;
      if (read_file(argv[i]), globalfilebuf != NULL) {
         msgbuf[0] = '\0';
         error_loop(_PICO_DO_(1, globalfilebuf));
         free(globalfilebuf);
         globalfilebuf = NULL;
      }
   }
   
   if (input) {

      if (chardev) {
         //rl_inhibit_completion = 1;
         rl_readline_name="tpico";
         rl_completion_entry_function=identifiergenerator;
         rl_completion_append_character=0;
         rl_completer_quote_characters="\"'";
         rl_basic_word_break_characters=" 	!#$%&()*+,-./:;<=>?@[\\]^`{|}~";
	 /* including quote characters causes [""dis] + <tab> -> [""display"] */
#ifdef RL_STATE_NONE // only defined by GNU readline
         _rl_enable_paren_matching(1);
         //rl_set_paren_blink_timeout(250000);
#endif
         /* tilde_expand() does not work on stupid OS/X readline */
         strncpy(historyfilename, getenv("HOME"), NAMELEN);
         historyfilename[NAMELEN-1] = '\0';
         if (strlen(historyfilename)+strlen("/.tpico_history") < NAMELEN)
            strcpy(historyfilename+strlen(historyfilename), "/.tpico_history");
         else strcpy(historyfilename, ".tpico_history");
         (void)read_history(historyfilename);
         stifle_history(500); /* 500 history entries should be enough... */
         using_history();
         history_active = 1;
         _PICO_DO_(1,""); /* identifiergenerator will fail before first eval */
      }

      while (!feof(stdin)) {
         at_prompt = 1;
         show("", ON_NEW_LINE);
         last_shown = '\0';
         if ((line = myreadline(">")) == NULL)
            break;
         last_shown = LF;
         if (!line[0] || line[0] == CR || line[0] == LF) {
            free(line);
            continue;
         }
         msgbuf[0] = '\0';
         if ((last == NULL || strcmp(line, last)) && chardev)
            add_history(line);
         at_prompt = 0;
         error_loop(_PICO_DO_(1, line));
         if (last != NULL)
            free(last);
         last = line;
      }
   }

   cleanup_exit(EXIT_SUCCESS);
}
Ejemplo n.º 3
0
Archivo: main.c Proyecto: tkadom/TWBLE
void HardFault_Handler(void)
{
    error_loop();
}
Ejemplo n.º 4
0
Archivo: main.c Proyecto: tkadom/TWBLE
/**
* @brief App error handle callback. Called whenever an APP_ERROR_CHECK() fails.
*   Never returns.
* 
* @param[in] error_code The error code sent to APP_ERROR_CHECK()
* @param[in] line_num Line where the error check failed 
* @param[in] p_file_name File where the error check failed
*/
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
    error_loop();
}
Ejemplo n.º 5
0
Archivo: main.c Proyecto: tkadom/TWBLE
/**
* @brief Softdevice crash handler, never returns
* 
* @param[in] pc Program counter at which the assert failed
* @param[in] line_num Line where the error check failed 
* @param[in] p_file_name File where the error check failed
*/
void sd_assert_handler(uint32_t pc, uint16_t line_num, const uint8_t* p_file_name)
{
    error_loop();
}