Looking for step-by-step example of importing an2295 project into CW 10.3 and successfully building. I'm doing this but get Undefined: __main error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Looking for step-by-step example of importing an2295 project into CW 10.3 and successfully building. I'm doing this but get Undefined: __main error

1,731 Views
johnnymclean
Contributor II

No matter what I've tried I always get the following:

'Building target: AN2295_Kinetis.afx'

'Executing target #3 AN2295_Kinetis.afx'

'Invoking: ARM Linker'

"C:/Freescale/CW MCU v10.3/MCU/ARM_Tools/Command_Line_Tools/mwldarm" @@"AN2295_Kinetis.args" -o "AN2295_Kinetis.afx"  

C:/Freescale/CW MCU v10.3/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Error

>Undefined : "__main"

Thanks, J.

0 Kudos
12 Replies

1,183 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

hi Johnny,

I couldn't reproduce your problem with an2295sw.

what chip do you work with?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,183 Views
johnnymclean
Contributor II

Hi Jennie,

I'm just trying to compile/build the default project. I try and build the default "Kinetis K 100MHz" and get the above errors. Everything default. I'm not changing any files. I've tried building all targets, and get the same errors.

I have CW 10.3, CW 10.6 and Design Studio installed on a PC running Windows7. I'm concerned, that if the an2295 demo works for you out of the box, there must be something wrong with my IDE installation. That somehow, the IDE's are interfering with each other? I don't see any reports of similar problems, so it must be my setup.

Could you describe your development environment. e.g.: Windows version, CodeWarrior version, etc. and has anyone had any luck building this in Design Studio?

Our project will use a K64, but haven't got there yet. I'm just trying to evaluate the an2295 in hope that we can use it.

Much thanks, Johnny

0 Kudos

1,183 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Johhny,

I just made a video of building an2295 on my side. I use CW10.6 with all updates installed.

for  K64 bootloader, i suggest you refer this link:

Kinetis Bootloader|Freescale

can this help?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,183 Views
johnnymclean
Contributor II

an2295_CW_10_3.PNG.png

Hi Zhang, thanks for the clip.

I've posted a screen grab of my CW 10.3 an2295 project. It doesn't have the same files yours does. I'm missing all the _cfg.h files in the CommonSource directory. Also missing the .c and .h files in the bootloader directory.

All I did was import the project and try and build it. Are there additional steps I must do? Also, could you zip up your an2295 project and post it, to see if I can build it successfully?

Thanks, John

0 Kudos

1,183 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Johhny,

this is an2295sw on my disk


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,183 Views
johnnymclean
Contributor II

Hi Zhang

I think my first issue is how to import the an2295 project into CW 10.3 or 10.6. "__main" is defined in bootloader.c. It's not getting found and built.

Should I be trying to import this project? Your zip file contains your absolute paths. I thought importing and exporting projects was a way to work around this. (e.g.: make projects portable?)

Thanks, John

0 Kudos

1,183 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Johnny McLean:

When importing the AN2295 project make sure NOT to select the option "Copy projects into workspace":

pastedImage_2.png

This is because the project takes its source files from "linked" folders and the links are broken when you select the Copy option. A similar topic is discussed in the next thread:

Re: CW 10.6 Import/Copy to workspace Example Project(s) Issue

Also make sure to disable the file bootloader_asm.s as instructed by colleague Jennie Zhang's video.

Regards!

Jorge Gonzalez

0 Kudos

1,183 Views
johnnymclean
Contributor II

Thanks Jorge

I should backup a bit. What version of an2295 are you using. I started with the version here:

AN2295 (HC08/S08 Developer's Serial Bootloader) updated for rev. 9.2 - CF V1 (alpha) support added

pavel.kreneks latest beta.

Is there a recommended version, with either CW or DS support?

I had tried your recommendation to not "Copy projects into workspace" but encountered errors like this:

mingw32-make: *** No rule to make target `C:\Temp\!\Kinetis\CommonSource\rs232\rs232.c', needed by `CommonSource/rs232/rs232_c.obj'. Stop.

Really just looking for a set of steps to get the "default" building. Want to get a clean default build before I start modifications for a FRDM K64.

Cheers, John

0 Kudos

1,183 Views
johnnymclean
Contributor II

I got Pavel Krenek's beta release to build with CodeWarrior 10.6., building the default Kinetis K 100MHz target. I did disable bootloader_asm.s as mentioned above. I had to do a global clean first or encountered errors, but then the build works fine.

Previously I had my workspace on a different drive. Changed the workspace to the default CW 10.6 install directory and stopped having problems.

Will try now to get the AN2295_FRDM_KL25Z_cfg.h based configuration to build.

Thanks everybody, J.

0 Kudos

1,183 Views
mjbcswitzerland
Specialist V

Hi John

In case you missed it the first time, there is a ready-to-go solution for the K64 (with multiple loader configurations) that can be opened/imported in CW10.6.

It may save your company time and money to use one that is industrially proven, fully documented and supported rather than solving basic issues.

Don't forget that Freescale has consolidated boot loading to the new KBOOT solution [Kinetis Bootloader|Freescale] (rather than various older ones like AN2295), which may not have been used on the K64 before and so could additionally involve extra porting development.

Note also that the K64 is not supported by CW10.6 (it will build but full K64 support is lacking) and so it is recommended to start with KDS to void repeating work.

Regards

Mark

Kinetis: µTasker Kinetis support

K64: µTasker Kinetis FRDM-K64F support / http://www.utasker.com/kinetis/TWR-K64F120M.html

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos

1,183 Views
johnnymclean
Contributor II

Hi Zhang

I downloaded the above zip file, extracted to a separate directory, then imported your project into CW 10.6. Did a "Clean" then tried to build. Initially it complained that it couldn't find "AN2295_LinkerFile.lcf" due to absolute path to your hard drive. (I thought the import would have corrected this? It did modify all other paths it seems. I had selected copy files to workspace, on the import??) I manually changed this to my path under "Project->Properties->Settings->ARM Linker->Input --> Linker Command File". Then I get the same error as I've been getting all along. See bellow. Can't fine __main.  Is there some global CodeWarrior setting that I need to make?

Thanks, John

**** Build of configuration Kinetis K 100MHz for project AN2295_Kinetis ****

"C:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j12 all

'Building target: AN2295_Kinetis.afx'

'Executing target #1 AN2295_Kinetis.afx'

'Invoking: ARM Linker'

"C:/Freescale/CW MCU v10.6/MCU/ARM_Tools/Command_Line_Tools/mwldarm" -o "AN2295_Kinetis.afx" @@"AN2295_Kinetis.args" 

C:/Freescale/CW MCU v10.6/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Error

>Undefined : "__main"

Errors caused tool to abort.

mingw32-make: *** [AN2295_Kinetis.afx] Error 1

0 Kudos

1,183 Views
mjbcswitzerland
Specialist V

Johnny

In case you prefer a loader for your K64 which will do UART (SREC and Kboot), USB (MSD, HID and Kboot), SD card and Ethernet (web server) without any porting/development issues you can take a look at:

http://www.utasker.com/kinetis/TWR-K64F120M.html

and/or

µTasker Kinetis FRDM-K64F support

It builds with the following IDEs

so no further development investment needed for any of these tool chains.

Fully documented in http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF

Can be simulated for analysis/review purposes and fully supported in this forum (or by email/telephone).

Will build for any KE, KV, KL or K part with the chosen peripheral method if needed for other parts/projects (so no porting/development effort for future projects needing a compatible loader solution).

Regards

Mark

Kinetis: µTasker Kinetis support

K64: µTasker Kinetis FRDM-K64F support / http://www.utasker.com/kinetis/TWR-K64F120M.html

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos