示例#1
0
void Boot::boot_flash(ulen off) const
 {
  DynArray<unsigned> boot;
  
  buildBoot(boot);

  const unsigned WS = sizeof (unsigned) ; // 4, unsigned == uint32

  if( boot.getLen()>(MaxFlashLen-BootDataOff)/WS )
    {
     Printf(Exception,"CCore::Boot::boot_flash() : too large boot");
    }
    
  ulen len=boot.getLen()*WS+BootDataOff;  
  
  ulen block_count=(len+Flash::BlockSize-1)/Flash::BlockSize;
  
  ulen block_index=off/Flash::BlockSize;
  
  for(ulen ind=block_index,lim=ind+block_count; ind<lim ;ind++) 
    if( !Flash::Erase(ind) )
      {
       Flash::ReadMode();
      
       Printf(Exception,"CCore::Boot::boot_flash() : flash erase failure");
      }
    else
      {
       Printf(Con,"Block #; erased\n",ind);
      }  
      
  if( !Flash::Write(off+BootDataOff,Range_const(boot)) )   
    {
     Flash::ReadMode();
    
     Printf(Exception,"CCore::Boot::boot_flash() : flash write failure");
    }
    
  PtrLen<const uint32> boot_code=Range(&__std_bootflash_beg,&__std_bootflash_end);  
    
  if( !Flash::Write(off,boot_code) )   
    {
     Flash::ReadMode();
    
     Printf(Exception,"CCore::Boot::boot_flash() : flash write failure");
    }
 }
示例#2
0
 virtual void layout(Point size_)
  {
   size=size_;
   
   field=Pane(size.x/4,size.y/4,size.x/2,size.y/2);
   
   for(ulen i=0,len=dots.getLen(); i<len ;i++) dots_based[i]=dots[i]-field.getBase();
  }
示例#3
0
void Boot::boot_run() const
 {
  DynArray<unsigned> boot;
  
  buildBoot(boot,Range(&__std_boot_beg,&__std_boot_end));

  __std_boot(boot.getPtr(),boot.getPtr()+boot.getLen());
 }
   void printList()
    {
     Printf(out_file,"name list #;\n\n",rec_list.getLen());

     for(auto r=Range_const(rec_list); +r ;++r)
       {
        Printf(out_file,"#;\n",*r);
       }
    }
示例#5
0
 void select(Point point)
  {
   if( selected<dots.getLen() )
     {
      dots[selected]=point;
      dots_based[selected]=point-field.getBase();
      
      win->redraw();
     }
  }
示例#6
0
   BuilderSlot & take(ulen slot_id)
    {
     ulen len=bslots.getLen();

     if( slot_id>=len )
       {
        bslots.extend_default(LenAdd(slot_id-len,1));
       }

     return bslots[slot_id];
    }
示例#7
0
 virtual void clickLeft(Point point,MouseKey mkey)
  {
   if( mkey&MouseKey_Shift )
     {
      dots.reserve(1);
      dots_based.reserve(1);
     
      Insert(dots,selected,point);
      Insert(dots_based,selected,point-field.getBase());
      
      if( dots.getLen()>1 ) selected++;
      
      win->redraw();
     }
   else
     {
      select(point);
     }
  }
示例#8
0
 virtual void key(VKey vkey,KeyMod kmod)
  {
   switch( vkey )
     {
      case VKey_F1 :
       {
        draw_type=DrawPath;
        
        win->redraw();
       }
      break;
      
      case VKey_F2 :
       {
        draw_type=DrawLoop;
        
        win->redraw();
       }
      break; 
      
      case VKey_F3 :
       {
        draw_type=DrawCurvePath;
        
        win->redraw();
       }
      break; 
      
      case VKey_F4 :
       {
        draw_type=DrawCurveLoop;
        
        win->redraw();
       }
      break; 
      
      case VKey_F5 :
       {
        draw_type=DrawPathSmooth;
        
        win->redraw();
       }
      break; 
      
      case VKey_F6 :
       {
        draw_type=DrawLoopSmooth;
        
        win->redraw();
       }
      break;
      
      case VKey_F7 :
       {
        draw_type=DrawCurvePathSmooth;
        
        win->redraw();
       }
      break; 
      
      case VKey_F8 :
       {
        draw_type=DrawCurveLoopSmooth;
        
        win->redraw();
       }
      break; 
      
      case VKey_F9 :
       {
        draw_type=DrawSolid;
        
        win->redraw();
       }
      break;
      
      case VKey_F10 :
       {
        draw_type=DrawCurveSolid;
        
        win->redraw();
       }
      break;
      
      case VKey_F11 :
       {
        solid_flag=(solid_flag?SolidOdd:SolidAll);
        
        win->redraw();
       }
      break;
      
      case VKey_Tab :
       {
        if( ulen len=dots.getLen() )
          {
           if( kmod&KeyMod_Shift )
             {
              if( selected ) selected--; else selected=len-1;
             }
           else
             {
              if( ++selected >= len ) selected=0;
             }
          
           win->redraw();
          }
       }
      break;
      
      case VKey_Home :
       {
        if( dots.getLen() )
          {
           selected=0;
          
           win->redraw();
          }
       }
      break; 
      
      case VKey_End :
       {
        if( ulen len=dots.getLen() )
          {
           selected=len-1;
          
           win->redraw();
          }
       }
      break;
      
      case VKey_Delete :
       {
        ulen ind=selected;
        ulen len=dots.getLen();
        
        if( ind<len )
          {
           Remove(dots,ind);
           Remove(dots_based,ind);
           
           if( ind==len-1 && ind>0 ) selected=ind-1;
          
           win->redraw();
          }
       }
      break; 
     }
  }
示例#9
0
 virtual void draw(FrameBuf<DesktopColor> buf,bool) const
  {
   if( magnify )
     {
      CommonDrawArt art(buf);
      
      art.grid(cfg.magnify);
      
      switch( draw_type )
        {
         case DrawCurvePath       : art.curvePath_micro(Range_const(dots),cfg.path,focus,cfg.magnify); break;
         
         case DrawPathSmooth      : art.path_smooth_micro(Range_const(dots),cfg.path,focus,cfg.magnify); break;
         
         case DrawCurvePathSmooth : art.curvePath_smooth_micro(Range_const(dots),cfg.path,focus,cfg.magnify); break;
        }
     }
   else
     {
      CommonDrawArt art(buf);
      
      art.erase(cfg.back);
      
      art.block(field,cfg.field);
      
      if( draw_type<DrawSolid )
        {
         for(auto p : dots ) art.knob(p,cfg.knob_len,cfg.knob);
         
         if( selected<dots.getLen() ) cross(art,dots[selected],cfg.cross);
        }
      
      CommonDrawArt field_art(buf.cut(field));
      
      ClockTimer timer;
      
      switch( draw_type )
        {
         case DrawPath            : field_art.path(Range_const(dots_based),cfg.path); break;
         case DrawLoop            : field_art.loop(Range_const(dots_based),cfg.path); break;
         case DrawCurvePath       : field_art.curvePath(Range_const(dots_based),cfg.path); break;
         case DrawCurveLoop       : field_art.curveLoop(Range_const(dots_based),cfg.path); break;
         case DrawPathSmooth      : field_art.path_smooth(Range_const(dots_based),cfg.path); break;
         case DrawLoopSmooth      : field_art.loop_smooth(Range_const(dots_based),cfg.path); break;
         case DrawCurvePathSmooth : field_art.curvePath_smooth(Range_const(dots_based),cfg.path); break;
         case DrawCurveLoopSmooth : field_art.curveLoop_smooth(Range_const(dots_based),cfg.path); break;
         
         case DrawSolid           : field_art.solid(Range_const(dots_based),solid_flag,cfg.solid); break;
         case DrawCurveSolid      : field_art.curveSolid(Range_const(dots_based),solid_flag,cfg.solid); break;
        }
      
      auto time=timer.get();
      
      Printf(out,"#;[#;] #;\n",GetTextDesc(draw_type),dots.getLen(),time);
      
      if( draw_type>=DrawSolid )
        {
         if( selected<dots.getLen() ) cross(art,dots[selected],cfg.cross);
        }
     }
  }
示例#10
0
void BuildImage::operator () ()
 {
  Sort(Range(table));
     
  ulen max_name_len=8;
     
  for(auto &obj : table ) Replace_max(max_name_len,obj.name.len);
     
  StrPrintOpt name_opt;
     
  name_opt.width=max_name_len;
     
  Printf(Con,"#;  --------  --------  -----\n",RepeatChar(max_name_len,'-'));
   
  Printf(Con,"#;   address      size  flags\n",BindOpt(name_opt,"name"));
     
  Printf(Con,"#;  --------  --------  -----\n",RepeatChar(max_name_len,'-'));
  
  if( !table.getLen() )
    {
     Printf(Exception,"No sections");
    }
  
  load_base=table[0].sect.address;
     
  for(auto r=Range(table); +r ;++r)
    {
     Printf(Con,"#;  #8.16i;  #8.16i;  #;\n",BindOpt(name_opt,r->name),r->sect.address,r->sect.size,PrintFlags(r->sect.flags));
     
     uint32 lim=Guard(r->sect.address,r->sect.size);
     
     if( r.len>=2 )
       {
        auto &r1=r[1];
        
        if( r1.sect.address<lim )
          {
           Printf(Exception,"Section overlapp");
          }
             
        if( r1.sect.address>lim )  
          {
           Printf(Con,"#;  #8.16i;  #8.16i;  #;\n",RepeatChar(max_name_len,' '),lim,(r1.sect.address-lim),"hole");
          }
       }
     else
       {
        Printf(Con,"#;  #8.16i;\n",RepeatChar(max_name_len,' '),lim);
        
        load_lim=lim;
       }
    } 
       
  Printf(Con,"#;  --------  --------  -----\n\n",RepeatChar(max_name_len,'-'));  
     
  Printf(Con,"load_base = #8.16i;\n\n",load_base);
  Printf(Con,"load_lim = #8.16i;\n\n",load_lim);
  Printf(Con,"entry_point = #8.16i;\n\n",entry_point);
  
  if( entry_point<load_base || entry_point>=load_lim )
    {
     Printf(Exception,"Bad entry point");
    }
  
#if 1  
  
  if( load_base!=0x81000000 )
    {
     Printf(Exception,"Bad load base");
    }
  
  if( entry_point!=load_base )
    {
     Printf(Exception,"Bad entry point");
    }
  
#endif  
 }