pyocd / FlashAlgo

Framework for building Arm Cortex-M "FLM" style flash programming algorithms.
Apache License 2.0
159 stars 151 forks source link

uVision project cannot build #22

Open RdaZhongyao opened 8 years ago

RdaZhongyao commented 8 years ago

My env:

Python 2.7.12
progen 0.9.2
Keil MDK 5.17
ARM Compiler 5.06 update 1 (build 61)

As the README.md says, execute cmd:

$ progen generate -t uvision

then open project projectfiles\uvision\lpc4088\lpc4088.uvproj, try to build the target, log shows:

Build target 'lpc4088'

then MDK UV4.EXE collapses.

anything wrong?

RdaZhongyao commented 8 years ago

Improper template file causes the error!

That is the file: https://github.com/mbedmicro/FlashAlgo/blob/master/records/tools/uvision.uvproj.tmpl

          <AfterMake>
            <RunUserProg1>1</RunUserProg1>
            <RunUserProg2>1</RunUserProg2>
            <UserProg1Name>..\..\..\scripts\post_build.bat "#KARM\ARMCC\bin\fromelf --bin $L@L.axf -o $L@L" "#KARM\ARMCC\bin\fromelf --text -s $L@L.axf -o $L@L\symbols" "#KARM\ARMCC\bin\armar --create $L@L\@L.ar $L*.o"</UserProg1Name>
            <UserProg2Name>python ..\..\..\scripts\generate_blobs.py $L@L</UserProg2Name>
            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
          </AfterMake>

Fix it!

Just move these commands into bat file: https://github.com/mbedmicro/FlashAlgo/blob/master/scripts/post_build.bat

          <AfterMake>
            <RunUserProg1>1</RunUserProg1>
            <RunUserProg2>0</RunUserProg2>
            <UserProg1Name>..\..\..\scripts\post_build.bat $KARM $L @L</UserProg1Name>
            <UserProg2Name></UserProg2Name>
            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
          </AfterMake>
set KEIL_ARM=%1
REM make sure fromelf is part of path
set path=%KEIL_ARM%\ARMCC\bin;%path%
set base_path=%2
set trgt_name=%3
set base_name=%base_path%%trgt_name%
fromelf --bin %base_name%.axf -o %base_name%
fromelf --text -s %base_name%.axf -o %base_name%\symbols
armar --create %base_name%\%trgt_name%.ar %base_path%*.o
set SCRIPTS=..\..\..\scripts
python %SCRIPTS%\generate_blobs.py %base_name%

then the projects build correctly.