CHDK Wiki
Register
(→‎Other options: new Windows GUI for the GCC toolchain)
Tag: sourceedit
(26 intermediate revisions by 12 users not shown)
Line 5: Line 5:
   
 
== The working environment ==
 
== The working environment ==
The original 'ready-to-use' environment based on gcc 3.4.6 is available from [http://drop.io/chdkdev/asset/gcc-env-for-hdk-3-4-6 here].
+
The original 'ready-to-use' environment based on gcc 3.4.6 is available from [https://drive.google.com/folderview?id=0B08pqRtyrObja2U5RERBMG14Q0k&tid=0B08pqRtyrObjTy11Y003Sk1lYTQ#list here].
   
 
Note that this does not seem to work on Vista, though it works just fine on Windows XP.
 
Note that this does not seem to work on Vista, though it works just fine on Windows XP.
Line 13: Line 13:
 
===Other options===
 
===Other options===
 
* [[CHDK-Shell]] Windows GUI ([http://chdk.setepontos.com/index.php/topic,845.0.html Forum]). It does not change your environment and provides 'creature comforts' like automatic trunk source checking, downloading and compiling, changing menu defaults, and SD card manipulation ([[CardTricks]] is included).
 
* [[CHDK-Shell]] Windows GUI ([http://chdk.setepontos.com/index.php/topic,845.0.html Forum]). It does not change your environment and provides 'creature comforts' like automatic trunk source checking, downloading and compiling, changing menu defaults, and SD card manipulation ([[CardTricks]] is included).
  +
  +
* Alternative [https://chdk.setepontos.com/index.php?topic=12752.0 Windows GUI for the GCC toolchain] with many options (download recent source code, build options, insert/remove user code, upload CHDK binaries onto the camera)
   
 
* Build your own GCC 4 under cygwin by following the instructions at [[User:Geekmug/Compiling_CHDK_under_Windows]]
 
* Build your own GCC 4 under cygwin by following the instructions at [[User:Geekmug/Compiling_CHDK_under_Windows]]
Line 21: Line 23:
 
* Create a folder for CHDK project. For example, ''D:\CHDK''.
 
* Create a folder for CHDK project. For example, ''D:\CHDK''.
 
* Create a subfolder for working environment. For example, ''D:\CHDK\gcc''.
 
* Create a subfolder for working environment. For example, ''D:\CHDK\gcc''.
* Unpack the [http://www.zshare.net/download/gcc_env_for_hdk-3-4-6-rar.html archive with the environment] ''([http://rapidshare.de/files/39163428/gcc_env_for_hdk-3.4.6.rar.html mirror1], [http://drop.io/chdkdev/media mirror2])'' into this folder.
+
* Unpack the [http://www.zshare.net/download/gcc_env_for_hdk-3-4-6-rar.html archive with the environment] ''([http://rapidshare.de/files/39163428/gcc_env_for_hdk-3.4.6.rar.html mirror1], [http://drop.io/chdkdevelopment/media mirror2])'' into this folder.
  +
:::More mirrors: [http://www.box.net/shared/mh38jk1afy GCC 3.4.6], [http://www.box.net/shared/dxzitgl8je GCC 4.4.0], [http://www.box.net/shared/y7sedgl7d7 GCC 4.5.1]
* Add the folder with binaries to the PATH environment variable.<br>
 
  +
:::(self-extracting archives, can also be manually unpacked
  +
::: with [http://www.7-zip.org/download.html 7-Zip]; tested & working on Win2000/XP/Vista/7)
 
* Add the folder with binaries to the PATH environment variable.<br />
 
:Open Windows' 'Start' menu -> 'Control Panel' -> 'System', 'Advanced' tab, 'Environment Variables' button. I used ''User Variables'' for modifying PATH variable. If there is no PATH variable then just create it and assign 'D:\CHDK\gcc\bin' to it. If PATH variable already exists then append the value ';D:\CHDK\gcc\bin' (don't forget the delimiter '''';'''' (semicolon). Apply the new environment settings. If you get an error while compiling (ie ld.exe crashes), add the lib-directory to PATH too (i.e. D:\CHDK\gcc\lib)
 
:Open Windows' 'Start' menu -> 'Control Panel' -> 'System', 'Advanced' tab, 'Environment Variables' button. I used ''User Variables'' for modifying PATH variable. If there is no PATH variable then just create it and assign 'D:\CHDK\gcc\bin' to it. If PATH variable already exists then append the value ';D:\CHDK\gcc\bin' (don't forget the delimiter '''';'''' (semicolon). Apply the new environment settings. If you get an error while compiling (ie ld.exe crashes), add the lib-directory to PATH too (i.e. D:\CHDK\gcc\lib)
  +
:;Note
:;Note: All variables in Windows are case insensitive. So, if there is a variable named 'Path' or 'path' or 'pAtH' just modify the existing one. Do not create a new one in uppercase. Don't add '''';'''' (semicolon) at the end of PATH, this can get you into trouble !
+
:: All variables in Windows are case insensitive. So, if there is a variable named 'Path' or 'path' or 'pAtH' just modify the existing one. Do not create a new one in uppercase. Don't add '''';'''' (semicolon) at the end of PATH, this can get you into trouble !
   
 
==== The sources ====
 
==== The sources ====
  +
{{notice|CHDK source was split into two main streams effective Dec 26,2011. A stable stream was created as a branch and the main trunk became the development or unstable stream.}}
 
* Create a working directory. For example, ''D:\CHDK\src''.
 
* Create a working directory. For example, ''D:\CHDK\src''.
* Download the latest sources from [[wikipedia:Subversion_(software)|SVN]]-repository: [https://tools.assembla.com/chdk/ tools.assembla.com] into created directory.<br>
+
* Download the latest sources from [[wikipedia:Subversion_(software)|SVN]]-repository: [https://tools.assembla.com/chdk/ tools.assembla.com] into created directory using either of the following methods:<br />
 
:*SVN-Client
 
:*SVN-Client
 
::If you plan to participate in development or have your own version always up-to-date the SVN-client is preferable, because it can apply (merge) changes from/to [[wikipedia:Subversion_(software)|SVN]]-repository. You should consider using SVN, it can save you some pain if it's correctly used.
 
::If you plan to participate in development or have your own version always up-to-date the SVN-client is preferable, because it can apply (merge) changes from/to [[wikipedia:Subversion_(software)|SVN]]-repository. You should consider using SVN, it can save you some pain if it's correctly used.
::The SVN path to the CHDK source code is: <pre>https://tools.assembla.com/svn/chdk</pre>
+
::The SVN path to the CHDK source code are: <pre>https://tools.assembla.com/svn/chdk/trunk <- development</pre> or <pre>https://tools.assembla.com/svn/chdk/branches/release-1_1 <- stable</pre>
  +
 
::You can use Windows [http://tortoisesvn.net/downloads TortoiseSVN] Explorer Plugin or [http://subversion.tigris.org/project_packages.html SVN-client].
 
::You can use Windows [http://tortoisesvn.net/downloads TortoiseSVN] Explorer Plugin or [http://subversion.tigris.org/project_packages.html SVN-client].
  +
::When using console SVN-client, use the following to check out the sources from the SVN archive: <pre>svn checkout https://tools.assembla.com/svn/chdk/trunk chdk</pre>
+
::When using console SVN-client, use the following to check out the sources from the SVN archive: <pre>svn checkout https://tools.assembla.com/svn/chdk/trunk chdk</pre> or <pre>svn checkout https://tools.assembla.com/svn/chdk/branches/release-1_1 chdk</pre>
  +
 
:*ZIP-File
 
:*ZIP-File
::Just download sources as ZIP-archive directly: [https://tools.assembla.com/chdk/browser/trunk Trunk] or [https://tools.assembla.com/chdk/browser/branches/grand Grand's Branche].Open the ZIP-file and extract the contents to D:\CHDK\src\. Then check whether the folder 'bin' exists in the top sources directory (i.e. D:\CHDK\src\branches\grand\bin\). If it does not exist, create it.
+
::Just download sources as ZIP-archive directly: [https://tools.assembla.com/chdk/browser/trunk Trunk] or [https://tools.assembla.com/chdk/browser/branches/release-1_1 Stable]. Open the ZIP-file and extract the contents to D:\CHDK\src\. Then check whether the folder 'bin' exists in the top sources directory (i.e. D:\CHDK\src\branches\grand\bin\). If it does not exist, create it.
   
 
=== Compilation process ===
 
=== Compilation process ===
Before compiling you may have to restart your computer so that the environment variables get applied.
+
Before compiling you may have to push F5 on desktop or restart your computer so that the environment variables get applied.
 
After that, change the current directory to top sources directory (i.e. D:\CHDK\src\branches\grand\). Then type:
 
After that, change the current directory to top sources directory (i.e. D:\CHDK\src\branches\grand\). Then type:
 
gmake fir
 
gmake fir
Line 83: Line 93:
   
 
=== gmake.exe Error 258 ===
 
=== gmake.exe Error 258 ===
If you get a message like below while compiling CHDK trunk this most likely an issus with an other compiler using make is installed on your PC like WinAVR. '''Make shure theres no other compiler before CHDK make in your PATH'''. look above at [[Compiling CHDK under Windows#The_environment]] and [http://chdk.setepontos.com/index.php/topic,1330.msg12136.html#msg12136 Error compiling using gcc_env_for_hdk-3.4.6] .
+
If you get a message like below while compiling CHDK trunk this most likely an issus with an other compiler using make is installed on your PC like WinAVR. '''Make sure there's no other compiler before CHDK make in your PATH'''. look above at [[Compiling CHDK under Windows#The_environment]] and [http://chdk.setepontos.com/index.php/topic,1330.msg12136.html#msg12136 Error compiling using gcc_env_for_hdk-3.4.6] .
   
 
<pre>>> Entering to tools
 
<pre>>> Entering to tools
Line 95: Line 105:
 
= Links =
 
= Links =
 
*[[For_Developers|For Developers]]
 
*[[For_Developers|For Developers]]
 
 
[[Category:Development|Compiling CHDK under Windows]]
 
[[Category:Development|Compiling CHDK under Windows]]

Revision as of 20:11, 13 March 2016

To compile CHDK under Windows it is assumed that you have basic knowledge of Windows console usage. Also, it can be useful to have Unix-like environment as Cygwin or Mingw/MSys for advanced tools, but it's absolutely not needed if the 'ready-to-use' working environment is used.

The working environment

The original 'ready-to-use' environment based on gcc 3.4.6 is available from here.

Note that this does not seem to work on Vista, though it works just fine on Windows XP.

There's also a newer gcc 4.3 based environment available there, but on MS Windows it is recommended to use the CHDK-Shell...

Other options

  • CHDK-Shell Windows GUI (Forum). It does not change your environment and provides 'creature comforts' like automatic trunk source checking, downloading and compiling, changing menu defaults, and SD card manipulation (CardTricks is included).
  • Alternative Windows GUI for the GCC toolchain with many options (download recent source code, build options, insert/remove user code, upload CHDK binaries onto the camera)

Setting up

The environment

CHDK Path

PATH variable

More mirrors: GCC 3.4.6, GCC 4.4.0, GCC 4.5.1
(self-extracting archives, can also be manually unpacked
with 7-Zip; tested & working on Win2000/XP/Vista/7)
  • Add the folder with binaries to the PATH environment variable.
Open Windows' 'Start' menu -> 'Control Panel' -> 'System', 'Advanced' tab, 'Environment Variables' button. I used User Variables for modifying PATH variable. If there is no PATH variable then just create it and assign 'D:\CHDK\gcc\bin' to it. If PATH variable already exists then append the value ';D:\CHDK\gcc\bin' (don't forget the delimiter ';' (semicolon). Apply the new environment settings. If you get an error while compiling (ie ld.exe crashes), add the lib-directory to PATH too (i.e. D:\CHDK\gcc\lib)
Note
All variables in Windows are case insensitive. So, if there is a variable named 'Path' or 'path' or 'pAtH' just modify the existing one. Do not create a new one in uppercase. Don't add ';' (semicolon) at the end of PATH, this can get you into trouble !

The sources

Notice

CHDK source was split into two main streams effective Dec 26,2011. A stable stream was created as a branch and the main trunk became the development or unstable stream.

  • Create a working directory. For example, D:\CHDK\src.
  • Download the latest sources from SVN-repository: tools.assembla.com into created directory using either of the following methods:
  • SVN-Client
If you plan to participate in development or have your own version always up-to-date the SVN-client is preferable, because it can apply (merge) changes from/to SVN-repository. You should consider using SVN, it can save you some pain if it's correctly used.
The SVN path to the CHDK source code are:
https://tools.assembla.com/svn/chdk/trunk  <- development
or
https://tools.assembla.com/svn/chdk/branches/release-1_1  <- stable
You can use Windows TortoiseSVN Explorer Plugin or SVN-client.
When using console SVN-client, use the following to check out the sources from the SVN archive:
svn checkout https://tools.assembla.com/svn/chdk/trunk chdk
or
svn checkout https://tools.assembla.com/svn/chdk/branches/release-1_1 chdk
  • ZIP-File
Just download sources as ZIP-archive directly: Trunk or Stable. Open the ZIP-file and extract the contents to D:\CHDK\src\. Then check whether the folder 'bin' exists in the top sources directory (i.e. D:\CHDK\src\branches\grand\bin\). If it does not exist, create it.

Compilation process

Before compiling you may have to push F5 on desktop or restart your computer so that the environment variables get applied. After that, change the current directory to top sources directory (i.e. D:\CHDK\src\branches\grand\). Then type:

gmake fir

If you get this error:

cp: cannot create regular file `.//bin/main.bin': No such file or directory

you have to create the folder D:\CHDK\src\branches\grand\bin

By default, CHDK is compiled only for A610, fw1.00e. If you want to compile firmware for an another camera, just execute 'gmake' with PLATFORM and PLATFORMSUB arguments. For example:

 gmake PLATFORM=a620 PLATFORMSUB=100f fir

(Note that 'PLATFORM' & 'PLATFORMSUB' mentioned above should be in uppercase.)

To compile firmware for all cameras just type:

 gmake batch-zip

KP&S

Conflicts with Borland products

If there are Borland compilers in the PATH it can lead to compile failures due to using wrong binaries with same names as for working environment. For example:

>> Entering to platform/a620/sub/100f
boot.c -> boot.o
stubs_min.S -> stubs_min.o
boot.c -> stubs_auto.S
stubs_auto.S -> stubs_auto.o
-> stubs_entry.S
CAUTION! 'stubs_entry.S' is not uptated due to target firmware binary not found!
Touch Version 4.2 Copyright (c) 1998 Borland International

ERROR! There are unresolved addresses in 'stubs_entry.S' (a620-100f) for the following names:
File stubs_entry.S:
free
Please, add them into 'stubs_entry_2.S' manually!

To avoid such messages just isolate Borland products (e.g., by modifying the PATH variable).

Undefined reference to `sub_...'

Suddenly or just after an update, the following message appears:

-> main.elf
../platform/a610/sub/100e/libplatformsub.a(boot.o): In function `h_usrInit':
boot.c:(.text+0x4): undefined reference to `sub_FFC019BC'
boot.c:(.text+0x10): undefined reference to `sub_FFEB737C'
boot.c:(.text+0x14): undefined reference to `sub_FFEA3A54'

To fix this issue delete the file 'platform/XXX/sub/YYY/stubs_auto.S' and download it from repository again.

gmake.exe Error 258

If you get a message like below while compiling CHDK trunk this most likely an issus with an other compiler using make is installed on your PC like WinAVR. Make sure there's no other compiler before CHDK make in your PATH. look above at Compiling CHDK under Windows#The_environment and Error compiling using gcc_env_for_hdk-3.4.6 .

>> Entering to tools
/usr/bin/sh: -c: line 1: syntax error near unexpected token `;'
/usr/bin/sh: -c: line 1: `for i in ; do  echo \>\> Entering to tools/$i;  c:/gcc
_env_for_hdk-3.4.6/bin/gmake.exe -C $i FOLDER="tools/$i/" || exit 1;  echo \<\<
Leaving tools/$i;  done'
c:\gcc_env_for_hdk-3.4.6\bin\gmake.exe[1]: *** [all-recursive] Error 258
gmake: *** [all-recursive] Error 1

Links