hacking 麦步手表之(2)命令行编译工程

mbEDITOR.zip http://pan.baidu.com/s/1gf5kHhh

在无空格路径下解压解压并运行 注册.CMD 并注册编译目录成功后双击 _BUILD_MB.CMD 可编译相应目录中的工程,并运行MBX.EXE模拟表盘或APP

双击_BUILD_MB -WATCH.CMD生成OUT.MAI可装进手表中运行

@echo on
@set proj=%cd%
@set USE_SIMULATOR=TRUE
@rem @set CCDIR=E:\DESIGN\MBSDK_BN\EDITOR\tools
@REM @set CCDIR=D:\net\mbSDK-BEST_2\EDITOR\tools
@if not exist %MB_EDITOR_DIR%\cedt.exe (
     @echo CAN NOT FOUND EDITOR AND TOOLS!! 
     @goto err_theend
)
@set CCDIR=%MB_EDITOR_DIR%\tools

@PROMPT $g
@rem MODE CON:COLS=120 LINES=40
@ECHO  on
@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@REM color 0a
@color f6
 
@set PATH=%CCDIR%\mbcc\mingw32\bin;%CCDIR%\compiler\bin;%CCDIR%\mbcc\bin;%path%;%CCDIR%\bin

@rem 目录名作程序名
@for %%i in (.) do set fileName=%%~ni
@set exeName=%fileName%.exe
@title  %fileName%
@if not exist %proj%\sys.mai     copy /y /b %CCDIR%\mbcc\add\sys.mai %proj%\sys.mai
@if not exist %proj%\build     xcopy /y /e /i %CCDIR%\mbcc\add\build %proj%\build

@rem @if exist OUT.MAI @del /f  /q  OUT.MAI >>nul 
@if exist %exeName%  @del /f  /q   %exeName%

@echo. 
@echo ***pack resource***
pack
rem pause
@echo. 
@echo ***compiling***
arm-none-eabi-gcc -c *.c  -mthumb -mcpu=cortex-m0  -I %CCDIR%\SDK -I %proj%\build
@REM @echo ERRORLEVEL=%ERRORLEVEL%
@if ERRORLEVEL 1 goto err_theend

@echo. 
@echo ***linking***
arm-none-eabi-ld -r  *.o -o %proj%\build\maibu_code
@REM @echo ERRORLEVEL=%ERRORLEVEL%
@if ERRORLEVEL 1 goto err_theend

@echo. 
@echo ***listing***
arm-none-eabi-readelf -a %proj%\build\maibu_code
@REM @echo ERRORLEVEL=%ERRORLEVEL%
@if ERRORLEVEL 1 goto err_theend

@echo. 
@echo ***BUILD SUCCESSFULLY***

@REM copy OUT.MAI .\mbcc\bin\OUT.MAI
@rem copy maibu_res.h .\mbcc\include\maibu_res.h
@rem gcc.exe *.c -o "%CCDIR%\mbcc\bin\MBY.exe"  -I "%CCDIR%\mbcc\include" -L "%CCDIR%\mbcc\lib" -lmaibu -lpthreadGC2 -DLINUX -DWINDOW -DHAVE_STRUCT_TIMESPEC -DNEW -lm -lwsock32 -lcurl -lcurldll


@if "%USE_SIMULATOR%"=="TRUE" (
     @echo CREATING WINDOWS SIMULATOR...
     @if exist %exeName%  @del /f  /q   %exeName%
     gcc.exe    *.c -o %exeName% -DUSE_SIMULATOR -I %proj%\build -I "%CCDIR%\mbcc\include" -L "%CCDIR%\mbcc\lib" -lmaibu -lpthreadGC2 -DLINUX -DWINDOW -DHAVE_STRUCT_TIMESPEC -DNEW -lm -lwsock32 -lcurl -lcurldll


     @echo.
     @echo  add statements below for simulating
     @echo  int main^(^)
     @echo  {
     
     @echo       #ifdef USE_SIMULATOR
     @echo                 simulator_init^(^);                                    
     @echo       #endif
           @echo.

     
           @echo.

   
     @echo       #ifdef USE_SIMULATOR
     @echo                 simulator_wait^(^);                  
     @echo       #endif
     @echo                return 0;
     @echo  }     
      @if exist %exeName% (
                          @echo.
                          @echo successful 
                                                  
                          @echo running simulator...
                          start  mbx.exe
                          @rem ping 127.0.0.1 -n 2 >nul
                          sleep 200
                          @echo running application...
                          %exeName%
                     )

)
@if not %errorlevel% equ 0 (
     @echo 编译出错了,详细查看上面
    @CMD /K
     @pause
)
exit

:err_theend
@echo ERROR:SOMETHING WRONG HAPPENED


cmd /k


 

 

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

>set fileName=部落图腾

***pack resource***

>pack
-------------read appinfo.json-------------
uuid:f457188bcc659dd2de84e08170abb3c3
app_id:30208
name:閮ㄨ惤鍥捐吘
icon:5001
version:120
watchface:1
sysapp:0
res_num:23
res:0, type:0, name:NUMBER_0_BMP, file:0.bmp
res:1, type:0, name:NUMBER_1_BMP, file:1.bmp
res:2, type:0, name:NUMBER_2_BMP, file:2.bmp
res:3, type:0, name:NUMBER_3_BMP, file:3.bmp
res:4, type:0, name:NUMBER_4_BMP, file:4.bmp
res:5, type:0, name:NUMBER_5_BMP, file:5.bmp
res:6, type:0, name:NUMBER_6_BMP, file:6.bmp
res:7, type:0, name:NUMBER_7_BMP, file:7.bmp
res:8, type:0, name:NUMBER_8_BMP, file:8.bmp
res:9, type:0, name:NUMBER_9_BMP, file:9.bmp
res:10, type:0, name:NUMBER_10_BMP, file:10.bmp
res:11, type:0, name:NUMBER_0B_BMP, file:0b.bmp
res:12, type:0, name:NUMBER_1B_BMP, file:1b.bmp
res:13, type:0, name:NUMBER_2B_BMP, file:2b.bmp
res:14, type:0, name:NUMBER_3B_BMP, file:3b.bmp
res:15, type:0, name:NUMBER_4B_BMP, file:4b.bmp
res:16, type:0, name:NUMBER_5B_BMP, file:5b.bmp
res:17, type:0, name:NUMBER_6B_BMP, file:6b.bmp
res:18, type:0, name:NUMBER_7B_BMP, file:7b.bmp
res:19, type:0, name:NUMBER_8B_BMP, file:8b.bmp
res:20, type:0, name:NUMBER_9B_BMP, file:9b.bmp
res:21, type:0, name:NUMBER_10B_BMP, file:10b.bmp
res:22, type:0, name:FULL_BLACK_BMP, file:full_black.bmp

-----------------begin create res.h-------------
-----------------create res.h ok-------------
-----------------begin create res_file-------------
type:0, res_key:5001, offset:366, res_size:60, width:20, height:20
type:0, res_key:5002, offset:426, res_size:60, width:20, height:20
type:0, res_key:5003, offset:486, res_size:60, width:20, height:20
type:0, res_key:5004, offset:546, res_size:60, width:20, height:20
type:0, res_key:5005, offset:606, res_size:60, width:20, height:20
type:0, res_key:5006, offset:666, res_size:60, width:20, height:20
type:0, res_key:5007, offset:726, res_size:60, width:20, height:20
type:0, res_key:5008, offset:786, res_size:60, width:20, height:20
type:0, res_key:5009, offset:846, res_size:60, width:20, height:20
type:0, res_key:5010, offset:906, res_size:60, width:20, height:20
type:0, res_key:5011, offset:966, res_size:60, width:20, height:20
type:0, res_key:5012, offset:1026, res_size:270, width:45, height:45
type:0, res_key:5013, offset:1296, res_size:270, width:45, height:45
type:0, res_key:5014, offset:1566, res_size:270, width:45, height:45
type:0, res_key:5015, offset:1836, res_size:270, width:45, height:45
type:0, res_key:5016, offset:2106, res_size:270, width:45, height:45
type:0, res_key:5017, offset:2376, res_size:270, width:45, height:45
type:0, res_key:5018, offset:2646, res_size:270, width:45, height:45
type:0, res_key:5019, offset:2916, res_size:270, width:45, height:45
type:0, res_key:5020, offset:3186, res_size:270, width:45, height:45
type:0, res_key:5021, offset:3456, res_size:270, width:45, height:45
type:0, res_key:5022, offset:3726, res_size:270, width:45, height:45
type:0, res_key:5023, offset:3996, res_size:2048, width:128, height:128
-------------create res_file ok---------------
---------------prepare pack head----------
---------------read res_file----------
---------------read code----------
---------------write pack head----------
---------------write res ----------
---------------write code ----------
---------------pack file:閮ㄨ惤鍥捐吘 ok ----------

>rem pause

***compiling***

>arm-none-eabi-gcc -c *.c  -mthumb -mcpu=cortex-m0  -I D:\design\mbEDITOR\tools\SDK -I D:\design\mbEDITOR\workspace\个性时间样式\部落图腾\build
Tribal_V01.c: In function 'sys_time_change_callback':
Tribal_V01.c:203:31: warning: initialization makes pointer from integer without a cast [enabled by default]

***linking***

>arm-none-eabi-ld -r  *.o -o D:\design\mbEDITOR\workspace\个性时间样式\部落图腾\build\maibu_code

***listing***

>arm-none-eabi-readelf -a D:\design\mbEDITOR\workspace\个性时间样式\部落图腾\build\maibu_code
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          1640 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         11
  Section header string table index: 8

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 0004cc 00  AX  0   0  4
  [ 2] .rel.text         REL             00000000 000820 000128 08      9   1  4
  [ 3] .rodata           PROGBITS        00000000 000500 000068 00   A  0   0  4
  [ 4] .data             PROGBITS        00000000 000568 00000c 00  WA  0   0  4
  [ 5] .bss              NOBITS          00000000 000574 000008 00  WA  0   0  4
  [ 6] .comment          PROGBITS        00000000 000574 000071 01  MS  0   0  1
  [ 7] .ARM.attributes   ARM_ATTRIBUTES  00000000 0005e5 000031 00      0   0  1
  [ 8] .shstrtab         STRTAB          00000000 000616 000051 00      0   0  1
  [ 9] .symtab           SYMTAB          00000000 000948 000340 10     10  31  4
  [10] .strtab           STRTAB          00000000 000c88 00027a 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

There are no program headers in this file.

Relocation section '.rel.text' at offset 0x820 contains 37 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
0000001c  0000240a R_ARM_THM_CALL    00000000   res_get_user_bitmap
0000002e  0000260a R_ARM_THM_CALL    00000000   app_window_get_layer_b
00000040  0000310a R_ARM_THM_CALL    00000000   app_layer_set_bitmap_b
00000070  0000240a R_ARM_THM_CALL    00000000   res_get_user_bitmap
0000009e  0000280a R_ARM_THM_CALL    00000000   app_layer_create_bitma
000000b2  0000200a R_ARM_THM_CALL    00000000   app_layer_set_bg_color
000000d0  00002b0a R_ARM_THM_CALL    00000000   app_service_get_dateti
000000de  0000300a R_ARM_THM_CALL    00000000   __aeabi_uidiv
000000f8  0000330a R_ARM_THM_CALL    00000000   __aeabi_uidivmod
00000110  0000300a R_ARM_THM_CALL    00000000   __aeabi_uidiv
00000128  0000330a R_ARM_THM_CALL    00000000   __aeabi_uidivmod
0000013c  0000300a R_ARM_THM_CALL    00000000   __aeabi_uidiv
00000156  0000330a R_ARM_THM_CALL    00000000   __aeabi_uidivmod
0000016e  0000300a R_ARM_THM_CALL    00000000   __aeabi_uidiv
00000186  0000330a R_ARM_THM_CALL    00000000   __aeabi_uidivmod
0000024e  0000230a R_ARM_THM_CALL    00000000   app_window_add_layer
000002b8  0000230a R_ARM_THM_CALL    00000000   app_window_add_layer
000003a8  00002502 R_ARM_ABS32       00000000   time_xpos
000003ac  00002102 R_ARM_ABS32       00000004   time_ypos
000003b0  00002f02 R_ARM_ABS32       0000000c   get_bigicon_by_num
000003b4  00000302 R_ARM_ABS32       00000000   .data
000003b8  00002a02 R_ARM_ABS32       00000008   date_xpos
000003bc  00003202 R_ARM_ABS32       00000038   get_liticon_by_num
000003c0  00000302 R_ARM_ABS32       00000000   .data
000003c4  00000402 R_ARM_ABS32       00000000   .bss
000003c8  00000402 R_ARM_ABS32       00000000   .bss
000003e6  0000220a R_ARM_THM_CALL    00000000   memcpy
00000408  0000230a R_ARM_THM_CALL    00000000   app_window_add_layer
00000414  00000202 R_ARM_ABS32       00000000   .rodata
00000422  00002c0a R_ARM_THM_CALL    00000000   app_window_create
00000464  0000290a R_ARM_THM_CALL    00000000   app_window_stack_get_w
00000480  0000270a R_ARM_THM_CALL    00000000   app_window_update
0000048c  00000302 R_ARM_ABS32       00000000   .data
000004a8  00002d0a R_ARM_THM_CALL    00000000   app_window_stack_push
000004b6  00001f0a R_ARM_THM_CALL    00000000   maibu_service_sys_even
000004c4  00000302 R_ARM_ABS32       00000000   .data
000004c8  00001b02 R_ARM_ABS32       00000449   sys_time_change_callba

There are no unwind sections in this file.

Symbol table '.symtab' contains 52 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 SECTION LOCAL  DEFAULT    1
     2: 00000000     0 SECTION LOCAL  DEFAULT    3
     3: 00000000     0 SECTION LOCAL  DEFAULT    4
     4: 00000000     0 SECTION LOCAL  DEFAULT    5
     5: 00000000     0 SECTION LOCAL  DEFAULT    6
     6: 00000000     0 SECTION LOCAL  DEFAULT    7
     7: 00000000     0 FILE    LOCAL  DEFAULT  ABS Tribal_V01.c
     8: 00000000     0 NOTYPE  LOCAL  DEFAULT    3 $d
     9: 00000000     0 NOTYPE  LOCAL  DEFAULT    4 $d
    10: 00000000     4 OBJECT  LOCAL  DEFAULT    4 main_window_id
    11: 00000004     4 OBJECT  LOCAL  DEFAULT    4 time_icon_layer_id
    12: 00000008     4 OBJECT  LOCAL  DEFAULT    4 date_icon_layer_id
    13: 00000000     0 NOTYPE  LOCAL  DEFAULT    5 $d
    14: 00000000     0 NOTYPE  LOCAL  DEFAULT    5 time_old
    15: 00000004     0 NOTYPE  LOCAL  DEFAULT    5 date_old
    16: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 $t
    17: 00000001    74 FUNC    LOCAL  DEFAULT    1 replace_old_layer
    18: 0000004d   116 FUNC    LOCAL  DEFAULT    1 creat_icon_layer
    19: 000000c1   246 FUNC    LOCAL  DEFAULT    1 get_time_date
    20: 000001b9   532 FUNC    LOCAL  DEFAULT    1 creat_update_time_layer
    21: 000003a8     0 NOTYPE  LOCAL  DEFAULT    1 $d
    22: 000003cc     0 NOTYPE  LOCAL  DEFAULT    1 $t
    23: 000003cd    80 FUNC    LOCAL  DEFAULT    1 creat_background_layer
    24: 00000414     0 NOTYPE  LOCAL  DEFAULT    1 $d
    25: 0000041c     0 NOTYPE  LOCAL  DEFAULT    1 $t
    26: 0000041d    42 FUNC    LOCAL  DEFAULT    1 init_main_window
    27: 00000449    72 FUNC    LOCAL  DEFAULT    1 sys_time_change_callback
    28: 0000048c     0 NOTYPE  LOCAL  DEFAULT    1 $d
    29: 00000490     0 NOTYPE  LOCAL  DEFAULT    1 $t
    30: 000004c4     0 NOTYPE  LOCAL  DEFAULT    1 $d
    31: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND maibu_service_sys_event_s
    32: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_layer_set_bg_color
    33: 00000004     4 OBJECT  GLOBAL DEFAULT    3 time_ypos
    34: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND memcpy
    35: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_window_add_layer
    36: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND res_get_user_bitmap
    37: 00000000     4 OBJECT  GLOBAL DEFAULT    3 time_xpos
    38: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_window_get_layer_by_i
    39: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_window_update
    40: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_layer_create_bitmap
    41: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_window_stack_get_wind
    42: 00000008     4 OBJECT  GLOBAL DEFAULT    3 date_xpos
    43: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_service_get_datetime
    44: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_window_create
    45: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_window_stack_push
    46: 00000491    60 FUNC    GLOBAL DEFAULT    1 main
    47: 0000000c    44 OBJECT  GLOBAL DEFAULT    3 get_bigicon_by_num
    48: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __aeabi_uidiv
    49: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND app_layer_set_bitmap_bitm
    50: 00000038    44 OBJECT  GLOBAL DEFAULT    3 get_liticon_by_num
    51: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __aeabi_uidivmod

No version information found in this file.
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "Cortex-M0"
  Tag_CPU_arch: v6S-M
  Tag_CPU_arch_profile: Microcontroller
  Tag_THUMB_ISA_use: Thumb-1
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align_needed: 8-byte
  Tag_ABI_align_preserved: 8-byte, except leaf SP
  Tag_ABI_enum_size: small
  Tag_ABI_optimization_goals: Aggressive Debug

***BUILD SUCCESSFULLY***
CREATING WINDOWS SIMULATOR...

 add statements below for simulating
 int main()
 {
      #ifdef USE_SIMULATOR
                simulator_init();
      #endif


      #ifdef USE_SIMULATOR
                simulator_wait();
      #endif
               return 0;
 }

successful
running simulator...
Sleep 200 ms,total:0.2 sec
running application...
send(ip:127.0.0.1, port:12314)


 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值