PE 2.96 to 3.07 migration

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

PE 2.96 to 3.07 migration

917 Views
bull_thumper
Contributor I

Greetings. 

 

Quick background. The last time I wrote any firmware was about 25 years ago and back then I didn't have any tools like the Processor Expert to generate infrastructure code. Today, my primary job is as a software developer.

 

I have been given a board and corresponding source that was originally compiled with an older version of CodeWarrior and has parts generated by Processor Expert version 2.96. The first step was to compile the existing source and burn it. No problem here -- it worked as expected.  Next, I made the first mod is in the user code. No problem here either as I was able to compile and burn the change successfully. 

 

Here's the kicker: Modification two is turns out to be in the Processor Expert section to change the period of TPM10 from 500us to 750us. However when I make this change, it regenerates what seems to be its own code and now the project will not compile. All errors are in the generated code and there are too many differences to make reasonable sense of. 

 

The main difference that I cannot reconcile is in vectors.c, in particular Cpu_VicgInterrupt being reports as undefined. (See below for the complete difference.)

 

I'm using the current version of CodeWarrior "special" as this project is well within the limits and generated code reports:

**     Processor Expert 3.07 [04.34]

 

The purpose of this posting is to seek advice on the issues, pitfalls and techniques for migrating this code. In addition, is there a reference on the constants that might assist me in this migration?

 

Thank you very much for any input or information that might be offered here. I will be happy to provide any additional information as I am able. 

 

Dan 

 

 

Addendum from vectors.c to illustrate the differences in the fundamental structure of the generated source:

 

As generated by PE 2.96:

 

 

void (* const _vect[])() @0xFFCC = {   // Interrupt table

           ISR_RTI,

           IIC_Interrupt,

           ADC_Interrupt,

           KBD_Interrupt,

           SCI2TX_Interrupt,

           SCI2RX_Interrupt,

           SCI2ERR_Interrupt,

           SCI1TX_Interrupt,

           SCI1RX_Interrupt,

           SCI1ERR_Interrupt,

           SPI_Interrupt,

           TPM2OVR_Interrupt,

           TPM2CH4_Interrupt,

           TPM2CH3_Interrupt,

           TPM2CH2_Interrupt,

           TPM2CH1_Interrupt,

           TPM2CH0_Interrupt,

           TPM1OVR_Interrupt,

           TPM1CH2_Interrupt,

           TPM1CH1_Interrupt,

           IRBaseTimer_Interrupt,

           Cpu_OnClockMonitorInt,

           LVD_Interrupt,

           IRQPIN_Interrupt,

           Cpu_SWIInterrupt,

           _EntryPoint

   };

 

 

 

 

As generated by PE 3.07:

 

void (* near const _vect[])(void) @0xFFCC = { /* Interrupt vector table */
         Cpu_Interrupt,                /* Int.no. 25 Vrti (at FFCC)                  Unassigned */
         Cpu_Interrupt,                /* Int.no. 24 Viic1 (at FFCE)                 Unassigned */
         Cpu_Interrupt,                /* Int.no. 23 Vatd1 (at FFD0)                 Unassigned */
         Cpu_Interrupt,                /* Int.no. 22 Vkeyboard1 (at FFD2)            Unassigned */
         Cpu_Interrupt,                /* Int.no. 21 Vsci2tx (at FFD4)               Unassigned */
         Cpu_Interrupt,                /* Int.no. 20 Vsci2rx (at FFD6)               Unassigned */
         Cpu_Interrupt,                /* Int.no. 19 Vsci2err (at FFD8)              Unassigned */
         Cpu_Interrupt,                /* Int.no. 18 Vsci1tx (at FFDA)               Unassigned */
         Cpu_Interrupt,                /* Int.no. 17 Vsci1rx (at FFDC)               Unassigned */
         Cpu_Interrupt,                /* Int.no. 16 Vsci1err (at FFDE)              Unassigned */
         Cpu_Interrupt,                /* Int.no. 15 Vspi1 (at FFE0)                 Unassigned */
         Cpu_Interrupt,                /* Int.no. 14 Vtpm2ovf (at FFE2)              Unassigned */
         Cpu_Interrupt,                /* Int.no. 13 Reserved12 (at FFE4)            Unassigned */
         Cpu_Interrupt,                /* Int.no. 12 Reserved13 (at FFE6)            Unassigned */
         Cpu_Interrupt,                /* Int.no. 11 Reserved14 (at FFE8)            Unassigned */
         Cpu_Interrupt,                /* Int.no. 10 Vtpm2ch1 (at FFEA)              Unassigned */
         Cpu_Interrupt,                /* Int.no.  9 Vtpm2ch0 (at FFEC)              Unassigned */
         Cpu_Interrupt,                /* Int.no.  8 Vtpm1ovf (at FFEE)              Unassigned */
         Cpu_Interrupt,                /* Int.no.  7 Reserved18 (at FFF0)            Unassigned */
         Cpu_Interrupt,                /* Int.no.  6 Vtpm1ch1 (at FFF2)              Unassigned */
         IRBaseTimer_Interrupt,        /* Int.no.  5 Vtpm1ch0 (at FFF4)              Used */
         Cpu_VicgInterrupt,            /* Int.no.  4 Vicg (at FFF6)                  Used */
         Cpu_Interrupt,                /* Int.no.  3 Vlvd (at FFF8)                  Unassigned */
         Cpu_Interrupt,                /* Int.no.  2 Virq (at FFFA)                  Unassigned */
         Cpu_SWIInterrupt,             /* Int.no.  1 Vswi (at FFFC)                  Used */
         _EntryPoint                   /* Int.no.  0 Vreset (at FFFE)                Reset vector */
};

 

void (* near const _vect[])(void) @0xFFCC = { /* Interrupt vector table */

         Cpu_Interrupt,                /* Int.no. 25 Vrti (at FFCC)                  Unassigned */

         Cpu_Interrupt,                /* Int.no. 24 Viic1 (at FFCE)                 Unassigned */

         Cpu_Interrupt,                /* Int.no. 23 Vatd1 (at FFD0)                 Unassigned */

         Cpu_Interrupt,                /* Int.no. 22 Vkeyboard1 (at FFD2)            Unassigned */

         Cpu_Interrupt,                /* Int.no. 21 Vsci2tx (at FFD4)               Unassigned */

         Cpu_Interrupt,                /* Int.no. 20 Vsci2rx (at FFD6)               Unassigned */

         Cpu_Interrupt,                /* Int.no. 19 Vsci2err (at FFD8)              Unassigned */ 

        Cpu_Interrupt,                /* Int.no. 18 Vsci1tx (at FFDA)               Unassigned */

         Cpu_Interrupt,                /* Int.no. 17 Vsci1rx (at FFDC)               Unassigned */

         Cpu_Interrupt,                /* Int.no. 16 Vsci1err (at FFDE)              Unassigned */

         Cpu_Interrupt,                /* Int.no. 15 Vspi1 (at FFE0)                 Unassigned */

         Cpu_Interrupt,                /* Int.no. 14 Vtpm2ovf (at FFE2)              Unassigned */

         Cpu_Interrupt,                /* Int.no. 13 Reserved12 (at FFE4)            Unassigned */

         Cpu_Interrupt,                /* Int.no. 12 Reserved13 (at FFE6)            Unassigned */

         Cpu_Interrupt,                /* Int.no. 11 Reserved14 (at FFE8)            Unassigned */

         Cpu_Interrupt,                /* Int.no. 10 Vtpm2ch1 (at FFEA)              Unassigned */

         Cpu_Interrupt,                /* Int.no.  9 Vtpm2ch0 (at FFEC)              Unassigned */

         Cpu_Interrupt,                /* Int.no.  8 Vtpm1ovf (at FFEE)              Unassigned */

         Cpu_Interrupt,                /* Int.no.  7 Reserved18 (at FFF0)            Unassigned */

         Cpu_Interrupt,                /* Int.no.  6 Vtpm1ch1 (at FFF2)              Unassigned */

         IRBaseTimer_Interrupt,        /* Int.no.  5 Vtpm1ch0 (at FFF4)              Used */

         Cpu_VicgInterrupt,            /* Int.no.  4 Vicg (at FFF6)                  Used */

         Cpu_Interrupt,                /* Int.no.  3 Vlvd (at FFF8)                  Unassigned */

         Cpu_Interrupt,                /* Int.no.  2 Virq (at FFFA)                  Unassigned */

         Cpu_SWIInterrupt,             /* Int.no.  1 Vswi (at FFFC)                  Used */

         _EntryPoint                   /* Int.no.  0 Vreset (at FFFE)                Reset vector */

};

Labels (1)
Tags (1)
0 Kudos
4 Replies

407 Views
bull_thumper
Contributor I

Sorry for the second post, but I am still trying to get the hang of this board...

 

I have been looking around on the FreeScale downloads to perhaps find an older version of Processor Expert. Is there such a download that I might be directed to?

 

 

 

 

0 Kudos

407 Views
bull_thumper
Contributor I

Okay, I've solved the fundamental problem: to change the timing. I found Timer_SetCP and Timer_SetPV and made the change there.

 

While my immediate need is solved, although I will continue to experiment with the Processor Expert and learn more about the code that it generates.

 

In what situations does the Processor Expert lend itself to being an advantage or perhaps even a hinderance? I'd like to hear peoples opinions, especially those who started out without such tools as I had.

 

Cheerios!

 

Dan

0 Kudos

407 Views
bigmac
Specialist III

Hello Dan, and welcome to the forum.

 

It would appear that the earlier version of PE generates a separate ISR function for every interrupt source, with the unused interrupts referencing empty functions.  For the later PE version, the unused interrupts reference a common Cpu_Interrupt() ISR function, presumably automatically generated.

 

However, it would appear that some of the ISR function naming has also changed, so presumably your existing ISR code would not be referenced in these cases - you would need to paste the old code into the new function.  Interrupt number 4 would appear to be in this category.

 

There are two different aspects to PE, its use for MCU device initialisation, and the use of various "beans" for the operation of each peripheral module.  Note that many of the more complex beans are not available with the special edition of CW.  The vector table generation is associated with the device initialisation.  In my own case, I have occasionally made use of the device initialisation tool, but have never bothered with using the beans.

 

Keep in mind that, once the required code has been generated by PE, and is operating satisfactorily, PE can then be disengaged from the project so that the source code will not be further changed, which is probably applicable in your circumstances, with a major revision of PE.

 

The use of the device initialisation tool can be very convenient  for more complex devices, even though the code generated is simple, and could easily be hand coded with a detailed knowledge of the various peripherals.  It does ensure that the initialisation of all peripheral modules occurs, and that none has been missed.  Device initialisation can be applicable to either C or assembly coding.  Personally, I find that the comments within the code are somewhat cryptic - I prefer more detailed and functional comments to describe the setup of a peripheral.  This could be another reason for not continually regenerating the code.

 

As I have a hardware background, and have more recently migrated from assembly coding to embedded C coding, I tend not to consider using the PE beans for the operation of peripherals such as TPM, RTC, SPI, SCI and ADC, which are at the simpler end of the spectrum.  There might be more justification for using PE beans for use of the more complex peripherals, such as IIC, LCD, USB and MSCAN.  However, I have had no personal requirement for many of these modules, and use CW special edition in which these beans are not included.

 

Regards,

Mac

 

0 Kudos

407 Views
bull_thumper
Contributor I

Mac, thank you for your reply.

 

I had disengaged PE from the project when I made the changes in the generated code to change the timing and think I'll leave it that it. It works and I now know what to change.

 

Actually, what is most interesting to me is how for the small microprocessors have advanced. I really need to get up on the learining curve here!

 

I'm seeing PE as a useful kick-start, but I think I agree that for the simpler interfaces, hand coding just feels right for me. If I ever get into more complex interfaces, I will certainly consider letting the commercial versions of PE handle that stuff for me.

 

Again, thank you for your insights!

 

Dan

 

0 Kudos