Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,22 @@ The above limitations 1 through 4 are expected to be improved by TSIP from the n
# 11. Support

For support inquiries and questions, please email support@wolfssl.com. Feel free to reach out to info@wolfssl.jp as well.

## Appendix: Command-line build & flash (build.bat / debug_run.bat)

This folder also includes two helper batch files for building and flashing
from the command line instead of driving e2studio interactively. Both wrap
the same Renesas toolchain the IDE uses, and assume the `wolfssl`/`test`
projects and `smc_gen` sources already exist (sections 3-6 above).

- `build.bat [clean|crypt|bench|TLSClient|wolfssl]` builds the `wolfssl`
and `test` projects. The `wolfssl` mode force-rebuilds just the
wolfSSL-dependent sources after editing `user_settings.h`, without a slow
full `clean`.
- `debug_run.bat [restart]` flashes `test.x` to the board via Renesas Flash
Programmer (rfp-cli) and runs it. `restart` resets and reruns the
already-flashed image without reprogramming it.

Each script's default paths are tied to one specific e2studio/CCRX install;
see the comments at the top of each file for the environment variables to
override for your setup.
17 changes: 17 additions & 0 deletions IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,20 @@ wolfSSL_CTX_use_certificate_buffer あるいはwolfSSL_CTX_use_certificate_chain

## 11. サポート
ご質問・ご要望は、info@wolfssl.jp まで日本語でお知らせください。

## 付録: コマンドラインでのビルド・書き込み (build.bat / debug_run.bat)

e2studioのIDEを対話的に操作する代わりに、コマンドラインからビルド・書き込みを行うための
ヘルパーバッチファイルも本フォルダに含まれています。どちらもIDEと同じRenesasツールチェーンを
呼び出すもので、`wolfssl`/`test`プロジェクトと`smc_gen`のソース(上記3〜6節)が既に生成済みで
あることを前提としています。

- `build.bat [clean|crypt|bench|TLSClient|wolfssl]` は`wolfssl`・`test`両プロジェクトを
ビルドします。`wolfssl`引数は、`user_settings.h`編集後にwolfSSL関連のソースだけをフル
クリーンより高速に再ビルドします。
- `debug_run.bat [restart]` はRenesas Flash Programmer(rfp-cli)経由で`test.x`をボードに
書き込んで実行します。`restart`引数は、既に書き込み済みのイメージを再書き込みせずに
リセット・再実行します。

各スクリプトの既定パスは特定のe2studio/CCRXインストールに紐づいています。環境ごとに上書き
すべき環境変数は各ファイル冒頭のコメントを参照してください。
110 changes: 95 additions & 15 deletions IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,46 @@ setlocal

REM --- These paths are tied to a specific e2studio/CCRX install (plugin version, CCRX
REM version, platform ID) and will not exist as-is on a different machine or a different
REM e2studio/CCRX version. Set MAKE/CCRX_BIN/E2_UTILS in the environment before calling
REM build.bat to override the defaults below for your install. ---
if not defined MAKE set MAKE=C:\Renesas\e2_studio\eclipse\plugins\com.renesas.ide.exttools.gnumake.win32.x86_64_4.3.1.v20240909-0854\mk\make.exe
if not defined CCRX_BIN set CCRX_BIN=C:\PROGRA~2\Renesas\RX\3_6_0\bin
if not defined E2_UTILS set E2_UTILS=%USERPROFILE%\.eclipse\com.renesas.platform_1435879475\Utilities\ccrx
set PATH=%CCRX_BIN%;%E2_UTILS%;%PATH%
REM e2studio/CCRX version. Set MAKE/CCRX_BIN/E2_UTILS/E2_BUSYBOX in the environment before
REM calling build.bat to override the defaults below for your install. ---
set USING_DEFAULTS=
if not defined MAKE (
set MAKE=C:\Renesas\e2_studio\eclipse\plugins\com.renesas.ide.exttools.gnumake.win32.x86_64_4.3.1.v20240909-0854\mk\make.exe
set USING_DEFAULTS=1
)
if not defined CCRX_BIN (
set CCRX_BIN=C:\PROGRA~2\Renesas\RX\3_6_0\bin
set USING_DEFAULTS=1
)
if not defined E2_UTILS (
set E2_UTILS=%USERPROFILE%\.eclipse\com.renesas.platform_1435879475\Utilities\ccrx
set USING_DEFAULTS=1
)
REM Generated makefiles call BusyBox "sed"/"rm" directly (not via a shell), so this
REM directory must be on PATH or the linker/clean recipes fail with
REM "process_begin: CreateProcess(NULL, sed ...) failed".
if not defined E2_BUSYBOX (
set E2_BUSYBOX=C:\Renesas\e2_studio\eclipse\plugins\com.renesas.ide.exttools.busybox.win32.x86_64_1.3.6.v20230615-0931\bin
set USING_DEFAULTS=1
)
if defined USING_DEFAULTS (
echo [NOTICE] MAKE/CCRX_BIN/E2_UTILS/E2_BUSYBOX is not set. Using default paths below;
echo these are tied to one specific e2studio/CCRX install and will likely not exist
echo on a different machine or install. Please adjust the paths for your environment
echo by setting these variables before running build.bat.
echo MAKE = %MAKE%
echo CCRX_BIN = %CCRX_BIN%
echo E2_UTILS = %E2_UTILS%
echo E2_BUSYBOX = %E2_BUSYBOX%
echo.
pause
)
set PATH=%CCRX_BIN%;%E2_UTILS%;%E2_BUSYBOX%;%PATH%
set BASEDIR=%~dp0

set TARGET=all
set MODE=
set FORCE_WOLFSSL_REBUILD=
if /i "%1"=="clean" (
set TARGET=clean
) else if /i "%1"=="crypt" (
Expand All @@ -21,12 +51,22 @@ if /i "%1"=="clean" (
set MODE=bench
) else if /i "%1"=="TLSClient" (
set MODE=TLSClient
) else if /i "%1"=="wolfssl" (
set FORCE_WOLFSSL_REBUILD=1
) else if not "%1"=="" (
echo [ERROR] Unknown argument "%1".
echo Usage: build.bat [clean^|crypt^|bench^|TLSClient]
echo Usage: build.bat [clean^|crypt^|bench^|TLSClient^|wolfssl]
echo crypt -^> enables #define CRYPT_TEST in wolfssl_simple_demo.h
echo bench -^> enables #define BENCHMARK
echo TLSClient -^> enables #define SIMPLE_TLS_TSIP_CLIENT
echo wolfssl -^> force-rebuild files that depend on user_settings.h
echo ^(and other shared wolfSSL headers^) after editing it.
echo The generated makefiles only track each .c's own
echo mtime, not the headers it includes, so plain
echo incremental "build.bat" silently keeps stale objects;
echo "build.bat clean" catches it too but also nukes and
echo recompiles the untouched smc_gen driver/stack code,
echo which takes far longer than the wolfSSL side alone.
exit /b 1
)

Expand Down Expand Up @@ -64,21 +104,61 @@ if not exist "%BASEDIR%test\src\smc_gen" (
exit /b 1
)

echo ============================================================
echo wolfssl library [%TARGET%]
echo ============================================================
cd /d "%BASEDIR%wolfssl\Debug"
if defined FORCE_WOLFSSL_REBUILD (
echo ============================================================
echo wolfssl library [clean rebuild: only 73 objects, stays fast]
echo ============================================================
cd /d "%BASEDIR%wolfssl\Debug"
"%MAKE%" clean
REM %ERRORLEVEL% would be expanded once when this whole if-block is
REM parsed, before "%MAKE%" clean has even run, always reading as
REM whatever it was beforehand (0) and silently ignoring a failed
REM clean. "if errorlevel 1" tests the real, current errorlevel at
REM this point instead; the exit code below is a literal for the same
REM reason.
if errorlevel 1 (
echo [ERROR] wolfssl clean failed.
exit /b 1
)
) else (
echo ============================================================
echo wolfssl library [%TARGET%]
echo ============================================================
cd /d "%BASEDIR%wolfssl\Debug"
)
"%MAKE%" %TARGET%
if %ERRORLEVEL% neq 0 (
echo [ERROR] wolfssl build failed.
exit /b %ERRORLEVEL%
)

echo.
echo ============================================================
echo test application [%TARGET%]
echo ============================================================
cd /d "%BASEDIR%test\HardwareDebug"
if defined FORCE_WOLFSSL_REBUILD (
echo ============================================================
echo test application [selective rebuild: wolfSSL-facing sources only,
echo smc_gen driver/stack objects left untouched]
echo ============================================================
cd /d "%BASEDIR%test\HardwareDebug"
for %%F in (
src\client\simple_tcp_client.obj
src\client\simple_tls_tsip_client.obj
src\server\simple_tcp_server.obj
src\server\simple_tls_server.obj
src\key_data\key_data.obj
src\test\benchmark.obj
src\test\test.obj
src\test\wolfssl_dummy.obj
src\test_main.obj
src\wolfssl_tsip_unit_test.obj
) do (
if exist "%%F" del /f /q "%%F"
)
) else (
echo ============================================================
echo test application [%TARGET%]
echo ============================================================
cd /d "%BASEDIR%test\HardwareDebug"
)
"%MAKE%" %TARGET%
if %ERRORLEVEL% neq 0 (
echo [ERROR] test build failed.
Expand Down
58 changes: 54 additions & 4 deletions IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/debug_run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,69 @@ set TARGET_X=%BASEDIR%test\HardwareDebug\test.x
set TARGET_MOT=%BASEDIR%test\HardwareDebug\test.mot
set RFP_LOG=%BASEDIR%test_result.log

set MODE=reload
if /i "%1"=="restart" (
set MODE=restart
) else if not "%1"=="" (
echo [ERROR] Unknown argument "%1".
echo Usage: debug_run.bat [restart]
echo ^(no arg^) -^> reload: convert+erase+program+verify test.x, then run
echo restart -^> just reset the already-flashed target and run it again,
echo without reprogramming
exit /b 1
)

REM --- Find the installed Renesas Flash Programmer CLI (version-independent) ---
for /d %%d in ("C:\Program Files (x86)\Renesas Electronics\Programming Tools\Renesas Flash Programmer V*") do set RFP_DIR=%%d
set RFP_CLI=%RFP_DIR%\rfp-cli.exe

if not exist "%TARGET_X%" (
echo [ERROR] %TARGET_X% not found. Run build.bat first.
exit /b 1
)
if not exist "%RFP_CLI%" (
echo [ERROR] rfp-cli.exe not found under "C:\Program Files (x86)\Renesas Electronics\Programming Tools\".
exit /b 1
)

if /i "%MODE%"=="restart" goto :restart_mode
goto :reload_mode

REM --- restart: just reset the already-flashed target, no reprogramming. Kept as
REM top-level (unindented, un-parenthesized) code like the reload path below it --
REM %RFP_EXIT%/%ERRORLEVEL% are otherwise expanded once at parse time if wrapped in
REM an if-block, before rfp-cli has even run, always reading as stale/empty. ---
:restart_mode
echo [1/1] Restarting target via E2 Lite ^(no reprogramming^)...
echo ============================================================
del "%RFP_LOG%" > nul 2>&1
REM Same connection/auth options as the reload path below, but with no hex file and
REM no -e/-p/-v/-a. -sig (read-only device signature check) is required even so:
REM with no operation at all, rfp-cli only connects the emulator, never the target
REM chip, so -run has no reset line to release and prints "No operation" -- -sig
REM forces a real (but safe, flash-untouched) target session so -run actually fires
REM on disconnect.
"%RFP_CLI%" ^
-device RX72x ^
-tool e2l ^
-if fine ^
-auth id FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ^
-noquery ^
-sig -run ^
-log "%RFP_LOG%"
set RFP_EXIT=%ERRORLEVEL%
echo ============================================================

if %RFP_EXIT% neq 0 (
echo [ERROR] rfp-cli exited with code %RFP_EXIT%
) else (
echo [DONE] Target restarted -- check Tera Term for UART output.
)

exit /b %RFP_EXIT%

:reload_mode
if not exist "%TARGET_X%" (
echo [ERROR] %TARGET_X% not found. Run build.bat first.
exit /b 1
)

echo [1/2] Converting ELF ^(test.x^) to Motorola S-record...
"%OBJCOPY%" -O srec "%TARGET_X%" "%TARGET_MOT%"
if %ERRORLEVEL% neq 0 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ $content = Get-Content -Raw -Path $file
# Pass 1: normalize all three macros to the uncommented ("#define X") form,
# regardless of their current state, so pass 2's substring replace can't
# double-wrap an already-commented line (e.g. match "#define X" inside
# "/*#define X*/").
# "/*#define X*/"). Whitespace inside the comment markers varies between
# macros (e.g. "/* #define CRYPT_TEST */" vs "/*#define BENCHMARK*/"), so
# match with a regex instead of a literal string.
foreach ($m in $macroMap.Values) {
$content = $content.Replace("/*#define $m*/", "#define $m")
$content = $content -replace "/\*\s*#define\s+$m\s*\*/", "#define $m"
}

# Pass 2: comment out every macro except the selected one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
<type>1</type>
<locationURI>PARENT-7-PROJECT_LOC/src/wolfio.c</locationURI>
</link>
<link>
<name>src/x509.c</name>
<type>1</type>
<locationURI>PARENT-7-PROJECT_LOC/src/x509.c</locationURI>
</link>
<link>
<name>wolfcrypt/port/renesas_common.c</name>
<type>1</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Path>..\..\..\..\..\..\..\src\tls.c</Path>
<Path>..\..\..\..\..\..\..\src\tls13.c</Path>
<Path>..\..\..\..\..\..\..\src\wolfio.c</Path>
<Path>..\..\..\..\..\..\..\src\x509.c</Path>
</Category>
<Category Name="wolfcrypt">
<Category Name="port">
Expand Down Expand Up @@ -89,7 +90,7 @@
</Category>
</Files>
<Device Category="com.renesas.cdt.managedbuild.renesas.ccrx.common.option.cpu.rx600" Series="RX">R5F572NNHxFB</Device>
<BuildOptions Name="CC-RX" Version="v3.04.00">
<BuildOptions Name="CC-RX" Version="v3.06.00">
<BuildMode Active="True" Name="Debug">
<GeneralOptions/>
<CompileOptions>
Expand Down Expand Up @@ -127,7 +128,7 @@
<Option>-output="${ProjName}.lib"</Option>
<Option>-form=library=u</Option>
<Option>-nomessage</Option>
<Option>-list=${ProjName}.lbp</Option>
<Option>-list</Option>
<Option>-nologo</Option>
<PreLinker>Auto</PreLinker>
</LinkOptions>
Expand All @@ -144,6 +145,7 @@
<Path>Debug\tls.obj</Path>
<Path>Debug\tls13.obj</Path>
<Path>Debug\wolfio.obj</Path>
<Path>Debug\x509.obj</Path>
<Path>Debug\renesas_common.obj</Path>
<Path>Debug\renesas_tsip_aes.obj</Path>
<Path>Debug\renesas_tsip_rsa.obj</Path>
Expand Down
Loading
Loading