Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SanyaPilot authored Jun 29, 2020
1 parent 7d2cc7b commit f996e85
Show file tree
Hide file tree
Showing 5 changed files with 852 additions and 0 deletions.
Binary file added asset.res
Binary file not shown.
155 changes: 155 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
@echo off
@setlocal EnableDelayedExpansion enableextensions
@cls
@if not defined COMPILER @SET COMPILER=GNUArmEmbeddedGCC
@cd %~dp0

:: ¢ë¤¥«ï¥¬ ­ ¨¬¥­®¢ ­¨¥ ¯ ¯ª¨ ¨§ ¯ã⨠áªà¨¯â  - íâ® ­ §¢ ­¨¥ í«ìä 
@SET PROGRAM_NAME=%~dp0
@for /D %%a in ("%PROGRAM_NAME:~0,-1%.txt") do @SET PROGRAM_NAME=%%~na

:: ãâì ª ª®¬¯¨«ïâ®àã
@SET BASE_PATH=d:\Dev\AmazfitBip_FW\soft\Patch\GNUArmEmbeddedGCC
@SET LIBRARY_PATH="!BASE_PATH!\arm-none-eabi\lib\thumb\v7e-m+fp\hard"
@SET LD_OPT=-lm -lc
@SET GCC_OPT=-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fno-math-errno
@SET EABI=arm-none-eabi
@SET COMPILERPATH=%BASE_PATH%\bin
@SET LIB_BIP="..\libbip\libbip.a"
@SET GCC_OPT=%GCC_OPT% -I "..\libbip"
@SET GCC_OPT=%GCC_OPT% -DFW_VERSION=%TERGET_FW_VERSION_GCC% -DLIB_BIP_H=\"..\/libbip\/libbip.h\"
@SET PATH=%PATH%;%COMPILERPATH%
@SET LD_LIBRARY_PATH=%LIBRARY_PATH%

@SET AS=%EABI%-as
@SET LD=%EABI%-ld
@SET OBJCOPY=%EABI%-objcopy
@SET GCC=%EABI%-gcc
@SET NM=%EABI%-nm
@SET GCC_OPT=%GCC_OPT% -c -Os -Wa,-R -Wall -fpie -pie -fpic -mthumb -mlittle-endian
@SET GCC_OPT=%GCC_OPT% -ffunction-sections -fdata-sections
@SET LD_OPT=%LD_OPT% -L%LIBRARY_PATH% -EL -N -Os --cref
@SET LD_OPT=%LD_OPT% -pie
@SET LD_OPT=%LD_OPT% --gc-sections

if exist label.txt (
set /p LABEL=< label.txt
) else (
SET LABEL = %PROGRAM_NAME%
)

@call :echoColor 0F "====================================" 1
@call :echoColor 0F " ¨¬¥­®¢ ­¨¥ ¯à®¥ªâ : "
@echo %PROGRAM_NAME%
::@call :echoColor 0F "Žâ®¡à ¦ ¥¬®¥ ¨¬ï: "
::@echo %LABEL%
@call :echoColor 0F "Š®¬¯¨«ïâ®à: "
@echo %COMPILER%
@call :echoColor 0F " §®¢ë© ¯ãâì: "
@echo %BASE_PATH%

@call :echoColor 0F "====================================" 1
@echo.

@call :echoColor 0F " ç¨­ ¥¬ á¡®àªã..." 1
@SET PARTNAME=%PROGRAM_NAME%
@call :echoColor 0B "Š®¬¯¨«ïæ¨ï "
@call :echoColor 0E "%PARTNAME%" 1

@SET n=1
@for %%f in (*.c) do (
@ SET FILES_TO_COMPILE=!FILES_TO_COMPILE! %%~nf.o
@call :EchoN "%n%. %%~nf.c"
!GCC! !GCC_OPT! -o %%~nf.o %%~nf.c
@if errorlevel 1 goto :error
@call :echoColor 0A "...OK" 1
@SET /a n=n+1)
@SET /a n=n-1
@call :echoColor 0B "ˆâ®£®: "
@call :echoColor 0E "%n%" 1

@call :echoColor 0B "‘¡®àª ..."
%LD% -Map %PARTNAME%.map -o %PROGRAM_NAME%.elf %FILES_TO_COMPILE% %LD_OPT% %LIB_BIP%
@if errorlevel 1 goto :error
::@call :echoColor 0B "."

if exist label.txt (
%OBJCOPY% %PROGRAM_NAME%.elf --add-section .elf.label=label.txt
)

if exist asset.res (
@call :echoColor 07 " ...à¥áãàáë" 1
%OBJCOPY% %PROGRAM_NAME%.elf --add-section .elf.resources=asset.res
)
if exist settings.bin (
@call :echoColor 07 " ...­ áâனª¨" 1
%OBJCOPY% %PROGRAM_NAME%.elf --add-section .elf.settings=settings.bin
)

@call :EchoN "%PROGRAM_NAME%%" > name.txt
%OBJCOPY% %PROGRAM_NAME%.elf --add-section .elf.name=name.txt
if exist name.txt del name.txt
@if errorlevel 1 goto :error

::@call :echoColor 0B "."

@call :echoColor 0A "OK" 1
@call :echoColor 0B "‘¡®àª  ®ª®­ç¥­ ." 1

:done_

@call :echoColor 0A "ƒ®â®¢®." 1
pause
@goto :EOF

:error
@call :echoColor 4e Ž˜ˆŠ€! 1
@endlocal & @SET ERROR=ERROR
@pause
@goto :EOF

::===========================================================
:: A function prints text in first parameter without CRLF
:EchoN

@ <nul set /p strTemp=%~1
@ exit /b 0
::===========================================================
:: A function to convert Decimal to Hexadecimal
:: you need to pass the Decimal as first parameter
:: and return it in the second
:DecToHex
@set LOOKUP=0123456789ABCDEF & set HEXSTR= & set PREFIX=0x

@if "%1" EQU "" set "%2=0"&Goto :exit_

@set /a A=%1 || exit /b 1
@if !A! LSS 0 set /a A=0xfffffff + !A! + 1 & set PREFIX=f
:loop
@set /a B=!A! %% 16 & set /a A=!A! / 16
@set HEXSTR=!LOOKUP:~%B%,1!%HEXSTR%
@if %A% GTR 0 Goto :loop
@set "%2=%PREFIX%%HEXSTR%"
@exit /b 0
::===========================================================
:: ‚뢮¤ § ¤ ­­®© áâப¨ § ¤ ­­ë¬ 梥⮬
:: 3 ¯ à ¬¥âà ¥á«¨ ­¥ ¯ãá⮩ § ¤ ¥â ¯¥à¥¢®¤ áâப¨
:: 0 = —¥à­ë© 8 = ‘¥àë©
:: 1 = ‘¨­¨© 9 = ‘¢¥â«®-ᨭ¨©
:: 2 = ‡¥«¥­ë© A = ‘¢¥â«®-§¥«¥­ë©
:: 3 = ƒ®«ã¡®© B = ‘¢¥â«®-£®«ã¡®©
:: 4 = Šà á­ë© C = ‘¢¥â«®-ªà á­ë©
:: 5 = ‹¨«®¢ë© D = ‘¢¥â«®-«¨«®¢ë©
:: 6 = †¥«âë© E = ‘¢¥â«®-¦¥«âë©
:: 7 = ¥«ë© F = Ÿàª®-¡¥«ë©
:echoColor [Color] [Text] [\n]
@ if not defined BS for /F "tokens=1 delims=#" %%i in ('"prompt #$H#& echo on& for %%j in (.) do rem"') do set "BS=%%i"
@ if not exist foo set /p .=.<nul>foo
@ set "regex=%~2" !
@ set "regex=%regex:"="%"
@ findstr /a:%1 /prc:"\." "%regex%\..\foo" nul
@ set /p .=%BS%%BS%%BS%%BS%%BS%%BS%%BS%%BS%%BS%<nul
@ if "%3" neq "" echo.
@exit /b 0
::===========================================================
====================================================
2 changes: 2 additions & 0 deletions label.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HR monitor
RU Монитор пульса
Loading

0 comments on commit f996e85

Please sign in to comment.