Converting Modelica models from Dymola to JModelica - Addressing Errors in Log File - modelica

I am currently trying to compile the netCDF-DataReader in JModelica but it appears the package has been developed in Dymola. The process fails at the compilation stage:
netCD = compile_fmu('NcDataReader2.Examples.Simple',r'H:\Modelica\Modelica Libraries\NcDataReader2',compiler_log_level= 'w,i:log.txt')
CcodeCompilationError: Compilation of generated C code failed.
The log file created contains 326 lines. Midway it says
====== Model compiled successfully =======
But there are many errors after. Some of the errors include:
Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" '
unrecognized collect2.exe: error: ld returned 1 exit status
mingw32-make1: *** [ceval_] Error 1 Cannot export
??_C#_01LFCBOECM#?4?$AA#: symbol not found Cannot export
??_C#_01NOFIACDB#w?$AA#: symbol not found
C:\JModelica.org-2.1\install\Makefiles\MakeFile:190: recipe for target
'fmume10' failed
I don't have much experience with compilers and debugging C-code and would prefer to spend my time focused on creating models; therefore this leads to a number of questions:
Are there patterns in this errror log that could be addressed in such a way to make Dymola libraries useable in other Modelica based programs, such as JModelica?
Are then any other compilers that may be more suited to cross-compatible models?
Am I wasting my time trying to make Dymola models run in JModelica? Would it be more sensible to recreate the model separately in JModelica? The lack of a front-end interface makes this tricky.

The problem is that the external libraries available in netCDF-DataReader needs to be compiled using the GCC compiler available in the JModelica distribution. Try to recompile the libraries using GCC and put the libraries in NcDataReader2\Resources\Library\win32 (or even better put them in NcDataReader2\Resources\Library\win32\gcc472)

Related

TIMESCALEMOD verilator error when attempting to add a new black box in chisel

I'm trying to add a new blackboxed verilog module to the chipyard hardware generation framework and simulate it with verilator.
My changes pass chipyard's scala compilation phase in which the chisel hardware specification is compiled into verilog. However, it appears during the "verilation" process in which that verilog is translated into a C++ executable, I'm encountering an error:
%Error-TIMESCALEMOD: [filename].v:238066:15: Timescale missing on this
module as other modules have it (IEEE 1800-2017 3.14.2.2)
chipyard/sims/verilator/generated-src/. . ./ClockDividerN.sv:8:8: ...
Location of module with timescale
8 | module ClockDividerN #(parameter DIV = 1)(output logic clk_out = 1'b0, input clk_in);
| ^~~~~~~~~~~~~ %Error: Exiting due to 1 error(s)
Searching around, the "timescale" this is referring to appears to be a configuration option for verilator simulations to do with how much time (usually in picoseconds) advances during one step of the simulation.
What's strange is the error claims that this module "ClockDividerN" (also a blackboxed verilog module included in the chipyard generator's vsrc directory) has a timescale, but the verilog source for ClockDividerN does not contain anything that appears to be a timescale.
Likewise, adding a timescale directive to the verilog source I'm trying to integrate produces the same error message. There are some verilator command-line options to do with timescales, but they're difficult to add in in the chipyard framework (it uses a pretty opaque makefile to run verilator).
Any help?
Update: the documentation for handling a TIMESCALEMOD error recommends using the "--timescale" command-line argument, but it turns out chipyard's Makefile for verilator simulations already uses that argument!
When adding your blackbox resources, something has gone wrong. Make sure the addResource path is correct. The TIMESCALEMOD error has nothing to do with this, but the blackbox path being included incorrectly causes that error to go off.

Issues With CMSIS In STM32IDE

I'm completely new to microcontroller programming and I'm facing my first problem.
I'm following tutorials and web documentation in order to starting with STM32 libraries, I tried to add CMSIS and HAL drivers into my stm32IDE but every time I try to build a huge quantity of errors occure. Someone can explain to me what is wrong ?
../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f412zx.s:399: Error: bad instruction `section .text:CODE:REORDER:NOROOT(1)'
../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f412zx.s:400: Error: bad instruction `i2c2_ev_irqhandler'
../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f412zx.s:403: Error: bad instruction `pubweak I2C2_ER_IRQHandler'
../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f412zx.s:404: Error: bad instruction `section .text:CODE:REORDER:NOROOT(1)'
../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f412zx.s:405: Error: bad instruction `i2c2_er_irqhandler'
../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f412zx.s:408: Error: bad instruction `pubweak SPI1_IRQHandler'
../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f412zx.s:409:
.
.
.
.
make: *** [Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/subdir.mk:91: Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f407xx.o] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.
00:32:15 Build Failed. 5895 errors, 0 warnings. (took 2s.475ms)
You are trying to compile the IAR startup files with the GCC compiler. The startup assembler file that you want is under the directory gcc. The two assemblers have different syntax.

Raspberry PI cross compilation linking error - unknown symbol _dl_hwcap

I have successfully set up a cross-complation environment for my RPI under 64 Bit ubuntu. I can compile and run a personal project using gstreamer just fine.
Due to performance-issues with gstreamer, I want to work on a fork of omxplayer. I adapted it to my environment, and compilation of ffmpeg and omxplayer themselves work just fine.
However, linking an actual executable (ffmpeg, or omxplayer.bin) yields a linking error I have been unable to resolve.
You find the full output of the last failing linking-step with verbose flags here:
https://gist.github.com/deets/3bba7c94017405d28f81
The error message is
ffmpeg_compiled/usr/local/lib/libavcodec.so: undefined reference to `_dl_hwcap'
collect2: error: ld returned 1 exit status
The missing symbol to me suggests something with dynamic loading. Maybe the libc or libdl are botched? But how come these are working just fine if compiling another project?
Found the culprit. When setting up the crosscompilation-environment, make sure your copy of the RPI's libraries are correct. I had unresolved symbolic library links that needed fixing in my rsync'ed copy of the RPI's file-system.

Unresolved __builtin_ia32_stmxcsr

I have inherited code, trying to compile with gcc on Linux.
what library am I looking for that has __builtin_ia32_stmxcsr ?
apologies -- i was too fast to submit; running gcc inside of Nvidia Eclipse. actual error message is "Functuion . . . could not be resolved" so i jumped the conclusion i needed to reference some lib. As the offending lines hav a :#if defined(SSE) I take it to mean that the -msse2 switch is present although i cannot seem to find a copyh of the compile command line. [just learning this Eclipse tool -- very new!]
You don't need to link with anything - the "builtin" in the name is a clue that it's a gcc built-in (intrinsic) compiler function.
However you do need to be compiling for an x86 target with SSE enabled for this to be recognised, e.g. gcc -msse2 ....
Note that you can use the _mm_getcsr intrinsic from <xmmintrin.h> instead of __builtin_ia32_stmxcsr - this would be a little more portable.
This is a bug in eclipses indexer with gcc's __builtin* functions. The bug report is at https://bugs.eclipse.org/bugs/show_bug.cgi?id=352537
The problem is that even the glibc/gcc libraries themselves use these __builtin* functions, so eclipse complains about a faulty xmmintrin.h etc., which is of course nonsense.
There is a workaround given in the bug report, you can add the function prototypes as user defined macros for the indexer, but of course this becomes tedious if there are a few more and some type checking abilities are lost.

error with "pmem.c" compiling linux source code for android

I am compiling linux source code for android emulator. When i execute make command(for building and cross-compiling the linux source) i get the following error "pmem.c" file.
root#ubuntu:~/common# make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
CC drivers/misc/pmem.o
drivers/misc/pmem.c:441: error: conflicting types for ‘phys_mem_access_prot’
/home/preetam/common/arch/x86/include/asm/pgtable.h:383: note: previous declaration of ‘phys_mem_access_prot’ was here
drivers/misc/pmem.c: In function ‘flush_pmem_file’:
drivers/misc/pmem.c:805: error: implicit declaration of function ‘dmac_flush_range’
drivers/misc/pmem.c: In function ‘pmem_setup’:
drivers/misc/pmem.c:1265: error: implicit declaration of function ‘ioremap_cached’
drivers/misc/pmem.c:1266: warning: assignment makes pointer from integer without a cast
make[2]: *** [drivers/misc/pmem.o] Error 1
make[1]: *** [drivers/misc] Error 2
make: *** [drivers] Error 2
root#ubuntu:~/common#
how to resolve this error. It seems that there may some problems in the "pmem.c" file and i'll have to choose different git repository. but that would be a very complex thing, as now i have already done most of the things till here. I might have to see correct version of this file. please someone tell what should i do?
how to solve this errors.
please help..thankyou!
There are several errors in the message you pasted, both conflicting types and implicit declarations. Three things that you might want to verify:
did you choose the correct processor architecture (ARCH) and cross compiler definition
does the chosen architecture mix in files from another arch (this is difficult to check, but you can start by checking the location of the files that are mentioned in the error message)
check these files themselves, to see it this is a bug (very unlikely, but you never know) and that you actually have to change some code