DSPRelated.com
Forums

Mem_Alloc and tsk 62x

Started by sophisblu April 23, 2007
What is the problem? I'm trying to allocate external SDRAM memory in a
TSK function defined in a Configuration CDB file. However Mem_alloc in
TSK function fails. To test Mem_alloc, I was able to allocate in the
during the initialization of the System and see memory allocated in
Kernal Object viewer. So the problem must be in the system level.

I read up on Mem_allocs and found out that dynamic memory functions
are disabled in HWI and SWi.

This led me to think maybe HWI is causing my system to fail. My system
generates a HWI when the user presses a button. The resulting HWI is
serviced by an ISR that signals the semaphore for the Task. The task
function then calls Mem_Alloc. I'm guessing HWI here is preventing
memory to be allocated? If not, what are the things I should check?

I've checked Configuration and all the Memory segment sizes, they look OK.
Sophis-

> What is the problem? I'm trying to allocate external SDRAM memory in a
> TSK function defined in a Configuration CDB file. However Mem_alloc in
> TSK function fails. To test Mem_alloc, I was able to allocate in the
> during the initialization of the System and see memory allocated in
> Kernal Object viewer. So the problem must be in the system level.
>
> I read up on Mem_allocs and found out that dynamic memory functions
> are disabled in HWI and SWi.
>
> This led me to think maybe HWI is causing my system to fail. My system
> generates a HWI when the user presses a button. The resulting HWI is
> serviced by an ISR that signals the semaphore for the Task. The task
> function then calls Mem_Alloc. I'm guessing HWI here is preventing
> memory to be allocated? If not, what are the things I should check?
>
> I've checked Configuration and all the Memory segment sizes, they look OK.

Try making the same Mem_alloc in main(), or another simple place in the code. My guess is your function fails there
also, which would mean the issue doesn't have to do with interrupts.

-Jeff
Sophis-

> Mem_alloc and Mem_free works in an idle task, so I assume they are
> working.

Ok, that's promising. Do you have some other way to set the semaphore to cause your TSK function to run? I.e. if you
can "simulate" the interrupt, it might reveal something. What if you create an OS timer based periodic TSK function
that sets the semaphore every 1 msec?

-Jeff

> --- In c..., "Jeff Brower" wrote:
>>
>> Sophis-
>>
>> > What is the problem? I'm trying to allocate external SDRAM memory in a
>> > TSK function defined in a Configuration CDB file. However Mem_alloc in
>> > TSK function fails. To test Mem_alloc, I was able to allocate in the
>> > during the initialization of the System and see memory allocated in
>> > Kernal Object viewer. So the problem must be in the system level.
>> >
>> > I read up on Mem_allocs and found out that dynamic memory functions
>> > are disabled in HWI and SWi.
>> >
>> > This led me to think maybe HWI is causing my system to fail. My system
>> > generates a HWI when the user presses a button. The resulting HWI is
>> > serviced by an ISR that signals the semaphore for the Task. The task
>> > function then calls Mem_Alloc. I'm guessing HWI here is preventing
>> > memory to be allocated? If not, what are the things I should check?
>> >
>> > I've checked Configuration and all the Memory segment sizes, they
> look OK.
>>
>> Try making the same Mem_alloc in main(), or another simple place in
> the code. My guess is your function fails there
>> also, which would mean the issue doesn't have to do with interrupts.
>>
>> -Jeff
>