DSPRelated.com
Forums

56F8013 and DSP_MEM manager

Started by Gentcho Nikolov December 9, 2005
Hello group,

Using 56F8013 for simple voice processing, I need
include SW bean VoiceActivityDetect. It on turn needs
MemoryManager bean. I have Heap size set, but calls to
MemoryManager (and especialy Initialization function)
doesn't recognize his start address and size. To make
them work I have check in the map for these values an
manualy set them in:
void MEM1_Init(void)
..
memIMpartitionAddr=(char *)0x01D0; //&_heap_addr;
memNumIMpartitions=0x300;
It helps at first step to allocate memmory, but the
way is abnormal.

Do you now what is necessary to make project to get
actual values for defined heap(like it is made in
StartUp for stack for example)? What generally
MemoryManager needs as additional initialization but I
haven't?

Thanks in advance,
Gentcho



For the proper function of the DSP_MEM bean it is necessary to create
at least one memory area in the CPU Bean Inspector in Build Options
tab (the PE in CodeWavarrior 7 allows to do this directly in the
DSP_MEM bean). This memory area has to have the qualifier set to
EXTERNAL_DYNAMIC or INTERNAL_DYNAMIC depending on the type of memory used.

If the external memory area is used it is necessary to have it defined
in the Properites tab in the External Bus / External memory group as
an External memory block and chip selects correctly set in the group
External Bus / Chip selects.

The memory layout can be observed by using the command Processor
Expert - View - Memory Map.

best regards
Petr Hradsky
Processor Expert Support Team
UNIS

--- In motoroladsp@moto..., Gentcho Nikolov <gentchon@y...> wrote:
>
> Hello group,
>
> Using 56F8013 for simple voice processing, I need
> include SW bean VoiceActivityDetect. It on turn needs
> MemoryManager bean. I have Heap size set, but calls to
> MemoryManager (and especialy Initialization function)
> doesn't recognize his start address and size. To make
> them work I have check in the map for these values an
> manualy set them in:
> void MEM1_Init(void)
> ..
> memIMpartitionAddr=(char *)0x01D0; //&_heap_addr;
> memNumIMpartitions=0x300;
> It helps at first step to allocate memmory, but the
> way is abnormal.
>
> Do you now what is necessary to make project to get
> actual values for defined heap(like it is made in
> StartUp for stack for example)? What generally
> MemoryManager needs as additional initialization but I
> haven't?
>
> Thanks in advance,
> Gentcho
>


Re-posting question to Yahoo group. Didn't get any help in Freescale
forums.
=================Hello all,
 
I'm working with 56F801 DSP for AC motor control. In my current software,
several functions are being called from an ISR. This is what I have:
 
-----------
From vector jumps:
 ...  jsr ISR_Function   // jump to ISR function  ...
-----------
void ISR_Function{
#pragma interrupt warn
    SecondFunction();    // call SecondFunction
}
-----------
#pragma interrupt called
void SecondFunction{
   AsmFunction();       // call assembly function
}
-----------
#pragma interrupt called
asm void AsmFunction{
    nop       // do something
}
 
Questions:
1) are the pragmas correctly used? For some reason, I'm still getting
warnings that a non-interrupt function is being called from an interrupt
function.
2) what happens if I call SecondFunction from a non-interrupt function (say
MainBackgroundTask)?
3) Is there any special requirement for interrupt-called assembly functions?
 
Thanks!
Mariano
	
Sankar: Tried that but for some reason, compiler is not accepting that. I
did a small program with empty subroutines and it is working. I guess I have
a mistake somewhere that is taking forever to debug. Thanks for the help.
 
JANE: I never call the interrupt routine from main task, but I do call a
math function that is used both in the ISR and main task. The user manual
specifies that all functions called from ISRs need the "#pragma interrupt
called" to be able to save the appropiate registers to stack. Thanks.
	  _____  

From: sankar murmu [mailto:murmu_s@murm...] 
Sent: Monday, March 06, 2006 11:08 AM
To: Mariano Filippa
Subject: Re: [motoroladsp] Use of #pragma interrupt (re-post)
	  1. Use "#pragma interrupt called" just before writing the prototype
of the
called (from an ISR or interrupt) function.

2. No issues, when you call Second function from main task.

3. You need to write prototype with "#pragma interrupt called".
	Hope all these will help you.
Regards,
Sankar
	On Sat, 04 Mar 2006 Mariano Filippa wrote :
>Re-posting question to Yahoo group. Didn't get
any help in Freescale
forums.
>=================>Hello all,
>
>I'm working with 56F801 DSP for AC motor control. In my current
software,
>several functions are being called from an ISR. This is what I have:
>
>-----------
> From vector jumps:
>  ...  jsr ISR_Function  // jump to ISR function  ...
>-----------
>void ISR_Function{
>#pragma interrupt warn
>    SecondFunction();    // call SecondFunction
>}
>-----------
>#pragma interrupt called
>void SecondFunction{
>    AsmFunction();      // call assembly function
>}
>-----------
>#pragma interrupt called
>asm void AsmFunction{
>    nop      // do something
>}
>
>Questions:
>1) are the pragmas correctly used? For some reason, I'm still getting
>warnings that a non-interrupt function is being called from an interrupt
>function.
>2) what happens if I call SecondFunction from a non-interrupt function (say
>MainBackgroundTask)?
>3) Is there any special requirement for interrupt-called assembly
functions?
>
>Thanks!
>Mariano
>
	
Found my problem... The compiler needed to have the "#pragma interrupt
called" before the first prototype declaration. I had my first declaration
in the header file as 'extern'.

I checked the code and the compiler generates RTIs and RTSs where needed.

Summary:

-----------
From vector table:
 ...  jsr ISR_Function()   // jump to ISR function  ...
-----------
void ISR_Function(void){
#pragma interrupt warn  *** THIS ONE NEEDS TO BE IN HERE, NOT BEFORE
PROTOTYPE ***
    SecondFunction();    // call SecondFunction
}  *** COMPILER ISSUES AN RTI HERE ***
-----------
From header file:
#pragma interrupt called
extern void SecondFunction(void);  *** FOR SOME REASON, PRAGMA GOES BEFORE
THIS DECLARATION ***
-----------
From c file:

void SecondFunction(void);  *** PRAGMA DOES NOT WORK BEFORE THIS DECLARATION
***
void SecondFunction(void){
	.....
} *** COMPILER ISSUES AN RTS FOR ALL CASES ***

Does this make any sense? I find it a bit strange to have to use the #pragma
in the declaration that has an 'extern'. Build manual does not seem to
specify this. Moreover, I could never make the #pragma work inside the
function body, as explained in the manual.

Thanks for all help
Mariano
	-----Original Message-----
From: JANE DING [mailto:jyding2000@jydi...]
Sent: Thursday, March 09, 2006 12:50 PM
To: Mariano Filippa
Subject: RE: [motoroladsp] Use of #pragma interrupt (re-post)

Mariano,

If you have math functions called both from appl and ISR, you have to define
a semaphore for each function to lock and unlock the function to prevent the
function is being called by Appl when ISR also jumped in.

I had a similar floating calculation function was called by ISR, then the
main() had error calculation results by calling the same func.

If you see "rti" at end of your other sunroutine functions, that is
wrong.
It should be "rts", because "rti" return-from-Interrupt is a
system call, it
will pop PC from Stack and send system back to Appl. 

The ISR should not be run a long period time, but if you disable the cpu
interrupt at start of ISR and enable interrupt at the end of ISR, it should
be OK to prevent other higher periority ISR happens.

I use C-code, I have a 2-ms timeout ISR (defined as
#pragma) calls a regular function (0x3AA+ words long), not defined as
#pragma, and this a regular function calls other math/ADC/PWM/DAC functions,
runs about 200-us (system clk@Mhz). 

I guess you can not call me, but in case:USA 818 264-8100.

Good luck,
Jane

#pragma interrupt called /* Comment this line if the appropriate 'Interrupt
preserve registers' property */
                         /* is set to 'yes' (#pragma
interrupt saveall is generated before the ISR)      */
void TO1_OnFalling(void)
{
  /* Write your code here ... */
  Cpu_DisableInt();
  regulatorCycle();
  Cpu_EnableInt();
}

/* END TmOut4Ms */

--- Mariano Filippa <mfilippa@mfil...> wrote:

> Sankar: Tried that but for some reason, compiler
is not accepting
> that. I did a small program with empty subroutines and it is working.
> I guess I have a mistake somewhere that is taking forever to debug.
> Thanks for the help.
> 
> JANE: I never call the interrupt routine from main task, but I do call
> a math function that is used both in the ISR and main task. The user
> manual specifies that all functions called from ISRs need the "#pragma
> interrupt called" to be able to save the appropiate registers to
> stack. Thanks.
> 
> 
> 
>
>   _____
>
> From: sankar murmu [mailto:murmu_s@murm...]
> Sent: Monday, March 06, 2006 11:08 AM
> To: Mariano Filippa
> Subject: Re: [motoroladsp] Use of #pragma interrupt
> (re-post)
>
>
>
>   1. Use "#pragma interrupt called" just before writing the
prototype
> of the called (from an ISR or interrupt) function.
>
> 2. No issues, when you call Second function from main task.
>
> 3. You need to write prototype with "#pragma interrupt called".
>
>
> Hope all these will help you.
> Regards,
> Sankar
>
>
> On Sat, 04 Mar 2006 Mariano Filippa wrote :
> >Re-posting question to Yahoo group. Didn't get any
> help in Freescale
> forums.
> >=================> >Hello all,
> >
> >I'm working with 56F801 DSP for AC motor control.
> In my current software,
> >several functions are being called from an ISR.
> This is what I have:
> >
> >-----------
> > From vector jumps:
> >  ...  jsr ISR_Function  // jump to ISR function
> ...
> >-----------
> >void ISR_Function{
> >#pragma interrupt warn
> >    SecondFunction();    // call SecondFunction
> >}
> >-----------
> >#pragma interrupt called
> >void SecondFunction{
> >    AsmFunction();      // call assembly function
> >}
> >-----------
> >#pragma interrupt called
> >asm void AsmFunction{
> >    nop      // do something
> >}
> >
> >Questions:
> >1) are the pragmas correctly used? For some reason,
> I'm still getting
> >warnings that a non-interrupt function is being
> called from an interrupt
> >function.
> >2) what happens if I call SecondFunction from a
> non-interrupt function (say
> >MainBackgroundTask)?
> >3) Is there any special requirement for
> interrupt-called assembly
> functions?
> >
> >Thanks!
> >Mariano
> >
>
>
>