嵌入式开发者社区
标题:
关于OMAPL138在SYSBIOS下DSP侧动态申请内存问题
[打印本页]
作者:
tulipyyf
时间:
2015-9-4 08:33
标题:
关于OMAPL138在SYSBIOS下DSP侧动态申请内存问题
创龙工程师你好,我在OMAPL138单独调试DSP程序(使用SYSBIOS)时,在任务中使用calloc函数动态申请内存,用完后free,类似如下结构
# p- A: t$ L' ?, y7 q! g
) Z. S1 r# M. N6 a% a
float *x_d=(float *)calloc(len_in,sizeof(float)); //256
( @7 ?( U! ~# H' x" E$ r% i
1 ~2 E; @2 ?: y0 q( w
其他程序段。。。。。
6 `; H& o5 Y* P
7 [* h( ^$ X) U1 W9 ?% D- T
free(x_d);
+ k! _# B( B( j
* \: I( H2 e8 t$ I! X+ [
使用DSP侧单独调试功能,验证动态申请没有问题,
/ m& a3 m0 \5 G5 }4 Z% Q
- D' t, X# c& B# e. Q9 F7 Y. ]2 H2 S
但是,
当ARM侧加载DSP核心程序实际运行时,上述函数申请的内存好像失败
,没有成功。请问是不是需要在哪里设置。
: D' W$ E8 V- \9 ?
9 O0 e4 u. }0 o* ~
p, J( A7 ^0 G# Z9 E$ a0 G# `3 G
* Q5 C6 h; S; g% C B1 ^
& P1 s3 L. t U( F
- H+ r0 Q( l& Q: O* B) I3 x
* R2 j0 e! C8 {
0 ^' d4 C7 |3 o2 t- `; N2 M8 g
5 z8 M6 A8 z2 v
7 s, }) V3 T$ p: J# z) [7 R
2 \! V# J& d( s
作者:
tulipyyf
时间:
2015-9-4 10:29
补充说明
( J2 J3 v! Y& u! ?+ N
我大约calloc 每次共计大小为5K*16bits,怀疑哪里需要配置一下
5 [0 j G, l* b6 h. ~
(不过疑惑的是,为何单独DSP仿真就没有问题呢?)
0 N0 ]; O0 c- c! T9 G, n
( d" N# k5 g8 p) @; y# e; p7 o
是不是需要在DSP.CFG中进行配置
$ P @4 @+ P* J( Z' x
我现在的配置为
7 J o V3 M! g8 D6 ^8 p& G/ T
# @* J; `0 T' n0 e7 L
/*
8 K/ i1 U6 j T& ]+ P6 Z% ~
* ======== Operating System Configuration ========
, x6 n# k/ i5 Y k
*/
& ?( h6 P0 @7 a) o
* o4 Z5 j0 m+ w0 a
/* no rts heap */
6 s9 m( ~" A9 l1 |3 I0 [4 |
Program.heap = 0;
6 [2 }+ A( m+ G- `
Program.argSize = 100; /* minimum size */
. ?8 _' S# T5 q. m
Program.stack = 0xF000;
//此处修改后的值。不太懂,所以改大
# s$ F% r, v+ n9 v
' {3 A8 I8 J5 X6 M- \3 @! B& c. Q
/* create a default heap */
0 R7 A8 |5 Q9 w' Z+ |8 v
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
$ k7 X. U4 H4 f5 P
var heapMemParams = new HeapMem.Params();
# I* z3 c$ o, A5 b+ h+ w. U( Z+ ?
heapMemParams.size = 0xFf00;
//此处修改后的值
。不太懂,所以改大
7 i, Z4 n, N, Z- r: J
% H; m/ w' T6 K1 _
var Memory = xdc.useModule('xdc.runtime.Memory');
; B: ^. @6 V+ R1 ]3 k, C
Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
) A) P5 b6 L4 f7 I- y, e
& v5 ]. y7 O" r9 S& Q" a J* s1 a
/* configure System module */
+ r6 h2 N' F0 {2 q
var SysMin = xdc.useModule('xdc.runtime.SysMin');
. b5 ], r9 ]8 ?( b/ s ]
SysMin.bufSize = 0x1000;
& c" J' q# y- S: g2 o0 V3 O6 n
SysMin.flushAtExit = false;
% p, Q1 |4 T) m0 @, E3 o9 y
. _: ?. v0 }0 X% m- X; {3 G
var System = xdc.useModule('xdc.runtime.System');
; m: C) D0 Y- v k* d; j
System.SupportProxy = SysMin;
* L6 r8 f1 g- f7 M' I
' l+ W, u! j, V6 h" x% N( x
/* configure SysBios to use the lower half of Timer 1 */
( c4 V- z) _3 W( a1 a
var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
* X; Z! m" y! N2 }* ], D f
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
% ^6 F& x2 P T* U) X2 u
Timer.timerSettings[1].master = true;
# U" ^+ F# @0 W, L6 H% ]- @
Timer.defaultHalf = Timer.Half_LOWER;
1 r# |: n, k7 R7 B/ }: [6 @/ F
Clock.timerId = 1;
]) R7 g; X+ l" l3 @: z
( F) j: l' Q H
1 L Z: ]1 @) k2 @$ C% K
/*
& b1 E8 W& D" q1 u4 N v( j! d+ m
* ======== Miscellaneous Configuration ========
. V$ q" ^; k- W( P5 V
*/
6 a, X2 u" G; C% e
9 [1 V/ C3 C. L7 I/ ^5 b) L
/* set default diags mask */
8 ?1 c" p8 h# @$ F e
var Diags = xdc.useModule('xdc.runtime.Diags');
' }) C) X6 t8 T& X6 G! W
var Defaults = xdc.useModule('xdc.runtime.Defaults');
1 n: W* R1 e K6 k0 M: `# ~4 r4 G
5 Z9 j: X8 O! ?! L# h5 l* h. @
Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
, @$ g8 N" ~/ l
Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
u i, X2 e7 C1 O
Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
% b; i5 o7 `* d h
Defaults.common$.diags_INTERNAL = Diags.ALWAYS_OFF; /* needed for asserts */
9 Q2 L. k# p) K) B5 @( _
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; /* development only */
" G2 D, {; z0 [5 s
Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
9 u7 w- W# c3 ?
Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
* h1 E% e+ s& i0 A8 Y! \
Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
( ~ {; V( m* L; R! A$ q6 N
Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
- D5 V* S' Q v8 V9 F
Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
' y% V1 R9 T1 I6 Z. Y; U3 ~
Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
5 H" e [* M% L4 m' U, d: g
Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
' Y0 Z: p: f m
Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
W5 \8 E' r& l
Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
2 p5 D7 h! N c/ W* ~9 O4 ?( u
# O1 Z. S" _, i* H$ @5 |: O& Z) C
/* override diags mask for selected modules */
/ D r/ ^9 A/ Z
xdc.useModule('xdc.runtime.Main');
& T, _. s6 a9 B$ X) e
Diags.setMaskMeta(
5 L/ v. ]( Z$ `
"xdc.runtime.Main",
- ~5 V( ^6 _2 L5 a% J5 v6 Z
Diags.ENTRY | Diags.EXIT | Diags.INFO,
- T1 h, i& S3 a( L5 n( A
Diags.RUNTIME_ON
% b, T- \9 {( W4 f5 K' e
);
9 I+ s7 q9 t/ ^7 J+ t, t
' @4 }, u8 ?& |$ z, y" S
var Registry = xdc.useModule('xdc.runtime.Registry');
) w# l# h9 l& q1 H0 y
Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
. \! H/ p4 ^8 b3 } ~; q
Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
6 a) x) _$ }: }
Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
4 _, {1 W2 O+ x) f
Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
) [9 ~ P% \! x1 v3 a. W
% x& R1 A! `, K$ ]. b
/* create a logger instance */
" S; L+ S# h. L7 z0 B
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
8 Y5 |5 L& s& p1 z: f
var loggerBufP = new LoggerBuf.Params();
+ _& u' g3 B, k" T- ]
loggerBufP.numEntries = 128; /* 128 entries = 4 KB of memory */
- O, t- v) X, T) X% s( [" }# v
loggerBufP.bufType = LoggerBuf.BufType_FIXED;
; Y2 ]/ S4 Z6 E' E7 _# w
, M h/ V: k6 M3 O/ B; J/ m& H4 ^0 P
var appLogger = LoggerBuf.create(loggerBufP);
. o4 n" E5 @) e% ]
appLogger.instance.name = "AppLog_Core1";
$ C' w$ [! k8 A" O( z( g5 x" N8 B3 f, |0 x
Defaults.common$.logger = appLogger;
$ X" w' ], R% e- L
Memory.defaultHeapSize = 0x8192;
' U/ w" l; n! v6 B0 b6 b+ A8 j. H
Idle.idleFxns[0] = "&LEDStatus";
5 C8 E2 ~0 l1 d( i: N% \
Cache.initSize.l2Size = Cache.L2Size_32K;
# s% ?& y/ Q4 K
! \9 }$ _5 i+ n# g/ H
作者:
tulipyyf
时间:
2015-9-7 15:38
为什么没人回答呢? 大家都不用动态申请内存方式吗?
作者:
teddy
时间:
2015-10-28 09:51
/* create a default heap */
. L! u5 u2 C' G) ]
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
5 `& N* b9 D% b
var heapMemParams = new HeapMem.Params();
( g$ @: Q7 ~& O3 k8 N
heapMemParams.size = 0x4000;
4 `* @) ^& j& O
4 h d8 R5 Z8 u9 G5 F, L
var Memory = xdc.useModule('xdc.runtime.Memory');
* X0 P( ]. d# C) T2 a
Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
% m# T2 P0 {, _6 Q: f
' c# z3 p7 V! \# {6 Q$ N: E
我大约calloc 每次共计大小为5K*16bits,
# m+ E$ g+ a3 b% `1 ?2 y
而默认配置才0x4000、需要改大。
: t6 b3 S, t: \% D' ~! S
3 h9 y4 y0 Q& ?" ~1 a- P' h+ n
作者:
tulipyyf
时间:
2015-10-28 16:14
/* no rts heap */
: n G) _" [& o0 h1 t
Program.heap = 0;
/ o- U' X9 j$ j3 ^
Program.argSize = 100; /* minimum size */
$ r& `9 y% |8 O3 r1 A
Program.stack = 0xF000; //我改到F000 也不行
作者:
teddy
时间:
2015-10-31 20:55
这个问题,我再测试一下,过两天实测后给你答复!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4