Author Topic: ERRORLEVEL problem in vsbuild  (Read 8179 times)

skywolf

  • Community Member
  • Posts: 22
  • Hero Points: 0
ERRORLEVEL problem in vsbuild
« on: March 18, 2009, 11:25:14 AM »
When use Slickedit with Keil Cx51 complier and build with vsbuild:
if warning occur in complier, vsbuild exit with error, skip the linker. (Normally it go on with linker.)
if warning occur in linker, vsbuild exit with error,skip the post build command. (Normally it will go on.)

Finally I found the fact that vsbuild will check ERRORLEVEL of previous command. If ERRORLEVEL>0, vsbuild will exit. It's OK in most complier. However the ERRORLEVEL of Keil Cx51 complier list in following table:
ERRORLEVEL    Description
       0            No Errors or Warnings
       1            Warnings Only
       2            Errors and Possibly Warnings
       3            Fatal Errors

Can we change how vsbuild use ERRORLEVEL to control build process?

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: ERRORLEVEL problem in vsbuild
« Reply #1 on: March 18, 2009, 11:59:04 AM »
You could try running the compiler from a batch file and manipulate the errorlevel
e.g.
keil.exe  %*
IF ERRORLEVEL 2 GOTO EXIT_ERROR
EXIT /B 0
:EXIT_ERROR
EXIT /B 2

skywolf

  • Community Member
  • Posts: 22
  • Hero Points: 0
Keil C51 complier option solution!
« Reply #2 on: March 19, 2009, 04:32:44 PM »
Thanks Graeme, I got your point!

Here is two cmd files for Keil C51 complier and linker, resolve two problem:
1.ERRORLEVEL>=1 when warnings occur, cause build process exit;
2.bl51.exe accept input object file list separated by comma, while file list expaned by "%f"  is separated by space.

c51.cmd file for complier:
--------------------------------------
@echo off
@rem usage: c51.cmd  "%f"  "%bd%n.o"
%KEIL_C%\BIN\c51.exe  %1   OBJECT (%2)  BROWSE DEBUG OBJECTEXTEND
IF ERRORLEVEL 2 GOTO EXIT_ERROR
EXIT /B 0
:EXIT_ERROR
EXIT /B 2
--------------------------------------

bl51.cmd file for linker:
--------------------------------------
@echo off
@rem usage: bl51.cmd "%f"  %bd%rn
@rem save file list to OBJ_FILE_LIST variale, like "a.obj b.obj c.obj "
set OBJ_FILE_LIST=%1
@rem replace space with comma: "a.obj,b.obj,c.obj,"
set OBJ_FILE_LIST=%OBJ_FILE_LIST: =,%
@rem delete the last comma,and surounding "" :a.obj b.obj c.obj
set OBJ_FILE_LIST=%OBJ_FILE_LIST:~1,-2%

%KEIL_C%\BIN\BL51.EXE %OBJ_FILE_LIST% TO %2.abs RAMSIZE(256)
if errorlevel 2 exit /B 1
%KEIL_C%\BIN\oh51.EXE  %2.abs  HEXFILE(%2.hex)
--------------------------------------
« Last Edit: March 19, 2009, 04:47:51 PM by skywolf »

koji

  • Community Member
  • Posts: 23
  • Hero Points: 0
Re: ERRORLEVEL problem in vsbuild
« Reply #3 on: October 13, 2009, 08:39:15 AM »
I did according to what you said. But when i built the files, the build windows showed that:
Code: [Select]
echo VSLICKERRORPATH="E:\02K"
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

E:\02K>VSLICKERRORPATH="E:\02K"

E:\02K>"D:\PROGRA~1\SLICKE~1.2\win\vsbuild" build "E:\02K\02K.vpw" "E:\02K\02K.vpj" -signal 9009
---------- Build Project: '02K.vpj' - 'Release' ---------- VSLICKERRORPATH="E:\02K"
main.C

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 FATAL-ERROR -
  ACTION:  PARSING INVOKE-/#PRAGMA-LINE
  LINE:    D:\Keil\C51\BIN\C51.exe OBJECT(
  ERROR:   NON-NULL ARGUMENT EXPECTED
C51 TERMINATED.
Ridcard.c

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 FATAL-ERROR -
  ACTION:  PARSING INVOKE-/#PRAGMA-LINE
  LINE:    D:\Keil\C51\BIN\C51.exe OBJECT(
  ERROR:   NON-NULL ARGUMENT EXPECTED
C51 TERMINATED.
RS485.C

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 FATAL-ERROR -
  ACTION:  PARSING INVOKE-/#PRAGMA-LINE
  LINE:    D:\Keil\C51\BIN\C51.exe OBJECT(
  ERROR:   NON-NULL ARGUMENT EXPECTED
C51 TERMINATED.
WR24C64.C

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 FATAL-ERROR -
  ACTION:  PARSING INVOKE-/#PRAGMA-LINE
  LINE:    D:\Keil\C51\BIN\C51.exe OBJECT(
  ERROR:   NON-NULL ARGUMENT EXPECTED
C51 TERMINATED.
Unable to remove file 'E:\02K\Release\'
Linking...

BL51 BANKED LINKER/LOCATER V6.15 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

*** FATAL ERROR L204: INVALID KEYWORD
    POS: 8
    D:\KEIL\C51\BIN\BL51.EXE TO .ABS #
Build successful
D:\Keil\C51\BIN\oh51.EXE "02K.abs"  HEXFILE("02K.hex")

OBJECT TO HEX FILE CONVERTER OH51 V2.6
COPYRIGHT KEIL ELEKTRONIK GmbH 1991 - 2001

*** ERROR: CAN'T OPEN FILE '02K.abs'

I used the command "%(KEIL_C)\BIN\c51.exe "%f" OBJECT (%bd%n.o) BROWSE DEBUG OBJECTEXTEND" instead of the c51.cmd and built files, the build windows showed that:
Code: [Select]
E: & cd E:\02K

E:\02K>echo VSLICKERRORPATH="E:\02K"
VSLICKERRORPATH="E:\02K"

E:\02K>"D:\PROGRA~1\SLICKE~1.2\win\vsbuild" build "E:\02K\02K.vpw" "E:\02K\02K.vpj" -signal 9009
---------- Build Project: '02K.vpj' - 'Release' ---------- VSLICKERRORPATH="E:\02K"
Compile/Link command change detected.  Some files may be rebuilt.
main.C

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
Ridcard.c

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
RS485.C

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
WR24C64.C

C51 COMPILER V8.17 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
Unable to remove file 'E:\02K\Release\'
Linking...

BL51 BANKED LINKER/LOCATER V6.15 - SN: K1AMC-IYE11C
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008

*** FATAL ERROR L204: INVALID KEYWORD
    POS: 8
    D:\KEIL\C51\BIN\BL51.EXE TO .ABS #
Build successful
D:\Keil\C51\BIN\oh51.EXE "02K.abs"  HEXFILE("02K.hex")

OBJECT TO HEX FILE CONVERTER OH51 V2.6
COPYRIGHT KEIL ELEKTRONIK GmbH 1991 - 2001

*** ERROR: CAN'T OPEN FILE '02K.abs'

The both methods were not success.
Can somebody help me?