changeset 47:d2074d1102e0

L1 data section placement: support both TMS470 and gcc
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 19 Jul 2018 01:04:05 +0000
parents 559a8b3ef10b
children c56f1d6202f5
files src/cs/layer1/dl1/dl1_com.c src/cs/layer1/include/l1_varex.h src/cs/layer1/p_include/l1p_vare.h
diffstat 3 files changed, 45 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/layer1/dl1/dl1_com.c	Thu Jul 19 00:35:33 2018 +0000
+++ b/src/cs/layer1/dl1/dl1_com.c	Thu Jul 19 01:04:05 2018 +0000
@@ -90,8 +90,14 @@
 
 #if ( (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_AAC == 1) || (L1_DYN_DSP_DWNLD == 1) )   // equivalent to an API_HISR flag
   extern void api_hisr(void);
-  #pragma DATA_SECTION (API_HISR_stack,"API_HISR_stack");
-  char FAR API_HISR_stack[0x400];
+  #ifdef __GNUC__
+    #define SECTION_ATTR __attribute__ ((section ("API_HISR_stack")))
+  #else
+    #define SECTION_ATTR
+    #pragma DATA_SECTION (API_HISR_stack,"API_HISR_stack");
+  #endif
+  char FAR API_HISR_stack[0x400] SECTION_ATTR;
+  #undef SECTION_ATTR
   NU_HISR apiHISR;
 #endif // (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_DYN_DSP_DWNLD == 1)
 
--- a/src/cs/layer1/include/l1_varex.h	Thu Jul 19 00:35:33 2018 +0000
+++ b/src/cs/layer1/include/l1_varex.h	Thu Jul 19 01:04:05 2018 +0000
@@ -10,27 +10,36 @@
 #ifdef L1_ASYNC_C
 
 #if (LONG_JUMP == 3)
- #pragma DATA_SECTION(l1s,".l1s_global")
- #pragma DATA_SECTION(l1s_dsp_com,".l1s_global")
- #pragma DATA_SECTION(l1a_l1s_com,".l1s_global")
- #pragma DATA_SECTION(l1s_tpu_com,".l1s_global")
- #pragma DATA_SECTION(l1_config,".l1s_global")
+  #ifdef __GNUC__
+    #define SECTION_ATTR __attribute__ ((section (".l1s_global")))
+  #else
+    #define SECTION_ATTR
+    #pragma DATA_SECTION(l1s,".l1s_global")
+    #pragma DATA_SECTION(l1s_dsp_com,".l1s_global")
+    #pragma DATA_SECTION(l1a_l1s_com,".l1s_global")
+    #pragma DATA_SECTION(l1s_tpu_com,".l1s_global")
+    #pragma DATA_SECTION(l1_config,".l1s_global")
+  #endif
+#else
+  #define SECTION_ATTR
 #endif
 
- T_L1S_GLOBAL   l1s;
+ T_L1S_GLOBAL   l1s SECTION_ATTR;
  T_L1A_GLOBAL   l1a;
 
- T_L1A_L1S_COM  l1a_l1s_com;
- T_L1S_DSP_COM  l1s_dsp_com;
- T_L1S_TPU_COM  l1s_tpu_com;
+ T_L1A_L1S_COM  l1a_l1s_com SECTION_ATTR;
+ T_L1S_DSP_COM  l1s_dsp_com SECTION_ATTR;
+ T_L1S_TPU_COM  l1s_tpu_com SECTION_ATTR;
 
- #if (L1_DYN_DSP_DWNLD == 1)    // equivalent to an API_HISR flag
+#if (L1_DYN_DSP_DWNLD == 1)    // equivalent to an API_HISR flag
  T_L1_API_HISR       l1_apihisr;
  T_L1A_API_HISR_COM l1a_apihisr_com;
 #endif
 
  // variables for L1 configuration
- T_L1_CONFIG    l1_config;
+ T_L1_CONFIG    l1_config SECTION_ATTR;
+
+ #undef SECTION_ATTR
 
 #else  // L1_ASYNC_C
 
--- a/src/cs/layer1/p_include/l1p_vare.h	Thu Jul 19 00:35:33 2018 +0000
+++ b/src/cs/layer1/p_include/l1p_vare.h	Thu Jul 19 01:04:05 2018 +0000
@@ -10,26 +10,35 @@
 #ifdef L1P_ASYN_C
 
 #if (LONG_JUMP == 3)
- #pragma DATA_SECTION(l1ps,".l1s_global")
- #pragma DATA_SECTION(l1pa_l1ps_com,".l1s_global")
- #pragma DATA_SECTION(l1ps_macs_com,".l1s_global")
- #pragma DATA_SECTION(l1ps_dsp_com,".l1s_global")
+  #ifdef __GNUC__
+    #define SECTION_ATTR __attribute__ ((section (".l1s_global")))
+  #else
+    #define SECTION_ATTR
+    #pragma DATA_SECTION(l1ps,".l1s_global")
+    #pragma DATA_SECTION(l1pa_l1ps_com,".l1s_global")
+    #pragma DATA_SECTION(l1ps_macs_com,".l1s_global")
+    #pragma DATA_SECTION(l1ps_dsp_com,".l1s_global")
+  #endif
+#else
+  #define SECTION_ATTR
 #endif
 
   // Global Packet L1A structure
   T_L1PA_GLOBAL    l1pa;
 
   // Global Packet L1S structure
-  T_L1PS_GLOBAL    l1ps;
+  T_L1PS_GLOBAL    l1ps SECTION_ATTR;
 
   // Common structure between L1A and L1S in packet mode
-  T_L1PA_L1PS_COM  l1pa_l1ps_com;
+  T_L1PA_L1PS_COM  l1pa_l1ps_com SECTION_ATTR;
  
   // Communication between L1S and MAC-S in packet mode
-  T_L1PS_MACS_COM  l1ps_macs_com;
+  T_L1PS_MACS_COM  l1ps_macs_com SECTION_ATTR;
 
   // MCU / DSP interface
-  T_L1PS_DSP_COM  l1ps_dsp_com;
+  T_L1PS_DSP_COM  l1ps_dsp_com SECTION_ATTR;
+
+  #undef SECTION_ATTR
 
 #else
   extern T_L1PA_GLOBAL    l1pa;