Bug in e_eeprom_xmc4 app

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hello,

the E_EEPROM_XMC4 app tries to copy a custom linker file when generating code. This fails in a very bad way when there are spaces in the project path. The problematic code is in E_EEPROM_XMC4/Templates/e_eeprom_xmc4/confc.tmpl. The issue is present in both version 4.04 and 4.06 of the app.

How to reproduce:

1. Change workspace to a path with spaces in it
2. Create new DAVE project
3. Add E_EEPROM_XMC4 app
4. Run Code Generation
5. Run compiler -> Compiler will fall over error output in "\Dave\Generated\E_EEPROM_XMC4\e_eeprom_xmc4_conf.c"

To see problem, replace "Dave\Generated\E_EEPROM_XMC4\e_eeprom_xmc4_conf.c" with this code:


package Model.APPS.E_EEPROM_XMC4.v4_0_6.Templates;

import Model.APPS.E_EEPROM_XMC4.v4_0_6.E_EEPROM_XMC4

import java.nio.file.*
out.print("""
/**
* @cond
***********************************************************************************************************************
*
* Copyright (c) 2016, Infineon Technologies AG
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
* following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes
* with Infineon Technologies AG (dave@infineon.com).
***********************************************************************************************************************
*
* Change History
* --------------
*
* 2016-01-20:
* - Initial version

*
* @endcond
*
*/
/***********************************************************************************************************************
* HEADER FILES
**********************************************************************************************************************/
#include "e_eeprom_xmc4.h"
""");
String appInst = null

for (E_EEPROM_XMC4 EEPROM_Inst : appInstancesList ) {
appInst = EEPROM_Inst.getInstanceLabel()

String ld_file_name = daveEnv.project.selectedDevice.deviceId.deviceName.split("-")[0]+"x"+daveEnv.project.selectedDevice.deviceId.deviceName.split("x")[1]

def scriptDir = new File(getClass().protectionDomain.codeSource.location.path).getParentFile()
def projectDir = scriptDir.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile().getParentFile()
try {
Files.delete(Paths.get(projectDir.path, "linker_script.ld"))
try {
Files.copy(Paths.get(scriptDir.path+"\\"+"linker_files", ld_file_name+".ld"), Paths.get(projectDir.path, "linker_script.ld"))
} catch (Exception e) {
println("#warning Could not copy from " + Paths.get(scriptDir.path+"\\"+"linker_files", ld_file_name+".ld") + " to " + Paths.get(projectDir.path, "linker_script.ld"))
}
}
catch (Exception e) {
println("#warning Could not delete " + Paths.get(projectDir.path, "linker_script.ld"))
}


out.println("""
E_EEPROM_XMC4_t ${appInst} =
{
.initialized = false
};
""");
}


To fix issue, replace line


def scriptDir = new File(getClass().protectionDomain.codeSource.location.path.toString()).getParentFile()


by



def scriptDir = new File(getClass().protectionDomain.codeSource.location.path.toString().replace("%20", " ")).getParentFile()


Please get this passed on to the appropriate people if you can reproduce it, otherwise feel free to ask any questions!
0 Likes
2 Replies
Not applicable
Exactly the same bug is present in the SDMMC_BLOCK App v. 4.0.10, in the file Model/Templates/sdmmc_block_externh.tmpl line 107.
0 Likes
Not applicable
HI,

Thank you for reporting this. This will be fixed and available in the July DAVE release.

In the meanwhile, I have logged an eticket (#153485026) to track this.
https://www.infineonforums.com/support/dave3/index.php?option=com_maqmahelpdesk&Itemid=0&id_workgrou...

Regards,
Daryl
0 Likes