Hi,
Currently I am working with CW5.1 and mc9sxdt512 controller.
I have to develop a firmware that it should run on different PCBs.
One PCB should support CAN BUS and it has a crystal of 16MHz.
The second will not support CAN BUS and it has crystal of 14.7MHz.
My thought is to have one project and two targets, named as following:
XDT512_CAN_BUS_16MHZ
XDT512_NO_CAN_BUS_14MHZ
Since the PCB have different crystals I should have two bootloaders.
Bootloader_CRYSTAL_14745600_XDT512.s19
Bootloader_CRYSTAL_16000000_XDT512.s19
The prm file should know what target is selected so it should merge the appropriate bootloader with HEXFILE command.
Also depending on the target, the canbus files should be included or not.
Unfortunatelly I cannot find a way to do it.
Does anyone know how it can be done or have any other suggestion?
Thank you
Hi,
yes, you could.
my suggestion is to use C macro definition. for example
#define CHIP_1
.............
.............
.............
#ifdef CHIP_1
// chip 1 code
#else
chip 2 code
#endif
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi, Jennie
Thank you for the response.
This is exactly what I need.
My client has just change his request and now he wants the Standard-NOCAN solution to support also the mc9s12dg256 controller.
So we have:
Standard-CAN target for mc9s12xdt512
Standard-NOCAN target for mc9s12xdt512 and mc9s12dg256.
Is there a way to make the Standard-NOCAN target to support both controllers?
Does it needed a new target solution for mc9s12dg256?
Thank you
Hi Jennie,
Thank you for the response. It really helps me.
Also I need something more.
Is it possible to have different c and h files according to selected target?
For a example at Standard-CAN target, the compile will join the canbus files (about 20 files) while at Standard-NOCAN target it will not.
Is it something that can be done?
Thank you.
Hi Eric,
yes, the same can work for files.
for example ,you want to add a file to Standard-CAN target only. see attached video. after that you will see the black dot show under the target column for Standard-CAN target.
does this answer your question?
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi
one solution is as follows:
1. create a new target
the two targets name can be "Standard-CAN","Standard-NOCAN"
2.set macro in each of the target compiler setting, for different target, macro __IFCAN value is different.
3. in C code, use this code to identify different target
I will attach my testing code and video.
can this help you?
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jennie,
Thank you for the response.
Can we do the same thing on prm file?
Since targets "Standard-CAN" and "Standard-NOCAN" have different crystals, I should have different bootloaders.
Can we have something like:
#ifdef __IFCAN
HEXFILE Boot_16.s19
#else
HEXFILE Boot_14.s19
#endif
Thank you
Hi Eric.
I don't think prm file can support C syntax.
in this case, I suggest you create two prm files:
boot_can.prm for Standard-CAN target. boot_nocan.prm for Standard-NOCAN target.
in linker setting, choose different prm for different target.
I will attached my revised demo code and video.
does this answer your question?
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------