Advertisement
Guest User

stm32.xsl

a guest
May 23rd, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.95 KB | None | 0 0
  1. <?xml version="1.0" ?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
  3. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
  4.  
  5. <!-- ============================================================================================================ -->
  6. <!-- OS (eecfg.c, stack definition) -->
  7. <!-- ============================================================================================================ -->
  8. <xsl:template match="object[@Type='OS']/parameter[@Name='CPU_DATA']/enumerator[@Name='CORTEX_MX']/parameter[@Name='MULTI_STACK']/enumerator[@Name='TRUE']" mode="build_eecfg_c">
  9. #include "ee.h"
  10.  
  11. // STACK configuration
  12. <xsl:if test="parameter[@Name='IRQ_STACK']/enumerator[@Name='TRUE']/parameter[@Name='SYS_SIZE']">
  13. #define STACK_IRQ_SIZE <xsl:value-of select="parameter[@Name='IRQ_STACK']/enumerator[@Name='TRUE']/parameter[@Name='SYS_SIZE']/@CurrValue"/><xsl:text> </xsl:text>
  14. int EE_stack_IRQ[STACK_IRQ_SIZE];
  15.  
  16. /* stack used only by IRQ handlers */
  17. struct EE_TOS EE_std_IRQ_tos = {
  18. (EE_ADDR)(&amp;EE_stack_IRQ[STACK_IRQ_SIZE - 1])
  19. };
  20.  
  21. </xsl:if>
  22.  
  23. <xsl:for-each select="../../../../../object[@Type='TASK']/parameter[@Name='STACK']/enumerator[@Name='PRIVATE']/parameter[@Name='SYS_SIZE']">
  24. #define STACK_<xsl:value-of select="../../../@Name"/>_ID <xsl:value-of select="position()" />U
  25. #define STACK_<xsl:value-of select="../../../@Name"/>_SIZE <xsl:value-of select="@CurrValue"/>
  26. int EE_stack_<xsl:value-of select="../../../@Name"/>[STACK_<xsl:value-of select="../../../@Name"/>_SIZE];
  27. </xsl:for-each>
  28.  
  29.  
  30. const EE_UREG EE_std_thread_tos[EE_MAX_TASK+1] = {
  31. 0U, /* dummy */<xsl:for-each select="../../../../../object[@Type='TASK']"><xsl:choose><xsl:when test="parameter[@Name='STACK']/enumerator[@Name='PRIVATE']/parameter[@Name='SYS_SIZE']">
  32. STACK_<xsl:value-of select="@Name"/>_ID,</xsl:when><xsl:otherwise>
  33. 0U,</xsl:otherwise></xsl:choose>
  34. </xsl:for-each>
  35. };
  36.  
  37.  
  38. struct EE_TOS EE_std_system_tos[<xsl:value-of select="count(../../../../../object[@Type='TASK']/parameter[@Name='STACK']/enumerator[@Name='PRIVATE']/parameter[@Name='SYS_SIZE'])+1"/>] = {
  39. {0}, /* shared */<xsl:for-each select="../../../../../object[@Type='TASK']/parameter[@Name='STACK']/enumerator[@Name='PRIVATE']/parameter[@Name='SYS_SIZE']">
  40. {(EE_ADDR)(&amp;EE_stack_<xsl:value-of select="../../../@Name"/>[STACK_<xsl:value-of select="../../../@Name"/>_SIZE - 1])},</xsl:for-each>
  41. };
  42.  
  43.  
  44. EE_UREG EE_std_active_tos = 0U; /* dummy */
  45. </xsl:template>
  46.  
  47.  
  48. <!-- ============================================================================================================ -->
  49. <!-- OS (eecfg.h) -->
  50. <!-- ============================================================================================================ -->
  51.  
  52.  
  53. <xsl:template match="object[@Type='OS']/parameter[@Name='CPU_DATA']/enumerator[@Name='CORTEX_MX']" mode="build_eecfg_h">
  54. </xsl:template>
  55.  
  56. <xsl:template match="object[@Type='OS']/parameter[@Name='CPU_DATA']/enumerator[@Name='CORTEX_MX']" mode="build_makefile">
  57. # Configuration for <xsl:value-of select="@Name"/>
  58.  
  59.  
  60. </xsl:template>
  61.  
  62. <!-- ============================================================================================================ -->
  63. <!-- MCU (makefie, add a define) -->
  64. <!-- ============================================================================================================ -->
  65. <xsl:template match="object[@Type='OS']/parameter[@Name='MCU_DATA']/enumerator[@Name='STM32']/parameter[@Name='MODEL']/enumerator[@Name='CUSTOM']" mode="build_makefile">
  66. <xsl:if test="parameter[@Name='MODEL']">
  67. CFLAGS += <xsl:value-of select="parameter[@Name='MODEL']/@CurrValue"/>
  68. ASFLAGS += <xsl:value-of select="parameter[@Name='MODEL']/@CurrValue"/>
  69. LDFLAGS += <xsl:value-of select="parameter[@Name='MODEL']/@CurrValue"/>
  70. </xsl:if>
  71. #
  72. </xsl:template>
  73.  
  74.  
  75. <!-- ============================================================================================================ -->
  76. <!-- STARTING POINT -->
  77. <!-- ============================================================================================================ -->
  78.  
  79. <xsl:template match="application">
  80. <CODE_GENERATION>
  81. <OUTPUT_BUFFER name="eecfg.h">
  82. <xsl:apply-templates select="/" mode="build_eecfg_h"/>
  83. </OUTPUT_BUFFER>
  84. <OUTPUT_BUFFER name="eecfg.c">
  85. <xsl:apply-templates select="/" mode="build_eecfg_c"/>
  86. </OUTPUT_BUFFER>
  87. <OUTPUT_BUFFER name="makefile">
  88. <xsl:apply-templates select="/" mode="build_makefile"/>
  89. </OUTPUT_BUFFER>
  90. </CODE_GENERATION>
  91. </xsl:template>
  92.  
  93. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement