Matrisberäkningar med för STM32?

PIC, AVR, Arduino, Raspberry Pi, Basic Stamp, PLC mm.
Användarvisningsbild
Al_Bundy
Inlägg: 2889
Blev medlem: 11 september 2012, 23:59:50
Ort: The U.S - Chicago
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av Al_Bundy »

Jag testade kompilera idag, men tydligen så saknar jag kompilatorn.

Kod: Markera allt

dell@dell-Precision-M6400:~/Hämtningar/gsl-2.5$ ./configure --host=arm-atollic-eabi-gcc --build=x86_64-pc-linux-gnu --target=arm-atollic-eabi-gcc --prefix=/homedell/Program/GSL CFLAGS="-c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-atollic-eabi-gcc-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a sed that does not truncate output... /bin/sed
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... Invalid configuration `arm-atollic-eabi-gcc': machine `arm-atollic-eabi' not recognized
configure: error: /bin/bash ./config.sub arm-atollic-eabi-gcc failed
dell@dell-Precision-M6400:~/Hämtningar/gsl-2.5$ 
Användarvisningsbild
AndLi
Inlägg: 18219
Blev medlem: 11 februari 2004, 18:17:59
Ort: Knivsta
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av AndLi »

Den stannar ju på att den inte känner igen din host... "arm-atolliv-eabi-gcc"
Jag anser du angivit fel --prefix det borde skulle vara 'arm-atolliv-eabi-'

då blir du också av med "configure: WARNING: using cross tools not prefixed with host triplet"
Som det är nu kommer den bygga med gcc och inte arm-atolliv-eabi-gcc
Användarvisningsbild
Al_Bundy
Inlägg: 2889
Blev medlem: 11 september 2012, 23:59:50
Ort: The U.S - Chicago
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av Al_Bundy »

Kod: Markera allt

dell@dell-Precision-M6400:~/Hämtningar/gsl-2.5$ ./configure --host=arm-atollic-eabi --build=x86_64-pc-linux-gnu --target=arm-atollic-eabi --prefix=/homedell/Program/GSL CFLAGS="-c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-atollic-eabi-strip... arm-atollic-eabi-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a sed that does not truncate output... /bin/sed
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-atollic-eabi
checking for arm-atollic-eabi-gcc... arm-atollic-eabi-gcc
checking whether the C compiler works... no
configure: error: in `/home/dell/Hämtningar/gsl-2.5':
configure: error: C compiler cannot create executables
See `config.log' for more details
dell@dell-Precision-M6400:~/Hämtningar/gsl-2.5$ 
Jag hittar faktiskt dessa mappar i TrueSTUDIO mappen.
Markering_028.png
Jag testa kopiera över dem till där Linux's egna bin, include, share och lib mapp befinner sig. Men kompileringen blir det samma.
Markering_029.png
Du har inte behörighet att öppna de filer som bifogats till detta inlägg.
Användarvisningsbild
Al_Bundy
Inlägg: 2889
Blev medlem: 11 september 2012, 23:59:50
Ort: The U.S - Chicago
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av Al_Bundy »

Jag har talat lite med Atollic nu och dem säger att man måste skriva in C-kod i utvecklingsverktyget. Så då sprack denna idé.

Men då hittade jag ett nytt bibliotek för C som har alla matriser som jag behöver.
https://github.com/jcchurch/C-Linear-Algebra

Vad tror ni om detta?
Användarvisningsbild
mankan
EF Sponsor
Inlägg: 934
Blev medlem: 18 juli 2015, 11:23:22
Ort: Linköping

Re: Matrisberäkningar med för STM32?

Inlägg av mankan »

Känns som ett väldigt förenklat svar från Atollic men du kan ju prova att importera källkoden till ett statiskt bibliotek i din arbetsyta. Dvs du använder IDE:et till att göra din Makefile som annars configure-skriptet ordnar åt dig. Kräver iofs att man sätter sig in lite i hur en korskompilering går till. Kräver säkert också nån handhackad utdata från configure-skriptet också, typiskt en h-fil config.h eller så.

Samma sak gäller även jcchurch-libbet minus configure-biten. Alternativt suger du bara in filerna i ditt projekt direkt. Dess Makefile är ju väldigt enkel så det ska nog gå.
Användarvisningsbild
Al_Bundy
Inlägg: 2889
Blev medlem: 11 september 2012, 23:59:50
Ort: The U.S - Chicago
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av Al_Bundy »

Ja. Det var ett rätt enkelt svar också.

Jag tror jag gör så att jag får helt enkelt skriva om lite av detta gamla C bibliotek och lägga upp det på min GitHub. Den har gjort det svåra jobbet. Jag saknar bara substraktion och addition.

Tror ni jag kan implementera denna C kod i min STM32? Detta vore riktigt häftigt om man kunde köra lite machine learning med 36x36 matriser på en STM32. :)
Mr Andersson
Inlägg: 1409
Blev medlem: 29 januari 2011, 21:06:30
Ort: Lapplandet

Re: Matrisberäkningar med för STM32?

Inlägg av Mr Andersson »

Det är inga problem att kompilera för ARM. Att få det att rymmas i flash är värre.

Kolla config.log som felmeddelanden säger. Testa lägga till --specs=nosys.specs i CFLAGS.

Det här fungerar för ARMs egen gcc-version. Ingen aning om vad atollic har ändrat i sin.
CFLAGS="-mthumb -mcpu=cortex-m4 -mfloat-abi=hard --specs=nosys.specs" ../configure --host=arm-none-eabi --enable-static --disable-shared
Användarvisningsbild
Al_Bundy
Inlägg: 2889
Blev medlem: 11 september 2012, 23:59:50
Ort: The U.S - Chicago
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av Al_Bundy »

Det verkar inte alls fungera.

Kod: Markera allt

dell@dell-Precision-M6400:~/Hämtningar/gsl-2.5$ CFLAGS="-mthumb -mcpu=cortex-m4 -mfloat-abi=hard --specs=nosys.specs" ./configure --host=arm-none-eabi --enable-static --disable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-none-eabi-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a sed that does not truncate output... /bin/sed
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-none-eabi
checking for arm-none-eabi-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/dell/Hämtningar/gsl-2.5':
configure: error: C compiler cannot create executables
See `config.log' for more details
dell@dell-Precision-M6400:~/Hämtningar/gsl-2.5$
Kör jag med annat mål än arm så fungerar det.
hawkan
Inlägg: 3415
Blev medlem: 14 augusti 2011, 10:27:40

Re: Matrisberäkningar med för STM32?

Inlägg av hawkan »

Här serru är felet

Kod: Markera allt

checking for arm-none-eabi-strip... no
Mr Andersson
Inlägg: 1409
Blev medlem: 29 januari 2011, 21:06:30
Ort: Lapplandet

Re: Matrisberäkningar med för STM32?

Inlägg av Mr Andersson »

Nej det är inget fel.
Al måste kolla loggfilen.
sodjan
EF Sponsor
Inlägg: 43244
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping

Re: Matrisberäkningar med för STM32?

Inlägg av sodjan »

Ja, det står ju i klartext: "See `config.log' for more details".
Kan vara klokt att kolla där först, innan man postar här.
Användarvisningsbild
Al_Bundy
Inlägg: 2889
Blev medlem: 11 september 2012, 23:59:50
Ort: The U.S - Chicago
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av Al_Bundy »

Japp! Har ingen kompilator och jag har försökt att installera en sådan. Men blev inget resultat. :|
Jag vet inte hur jag ska tolka denna logfil. Men jag misstänker att den klagar på detta. Jag testade även march och mtune, men det gav samma resultat.

Kod: Markera allt

configure:3482: checking whether the C compiler works
configure:3504: gcc -mthumb -mcpu=cortex-m4 -mfloat-abi=hard --specs=nosys.specs   conftest.c  >&5
gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
gcc: error: nosys.specs: No such file or directory

Kod: Markera allt

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by gsl configure 2.5, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --host=arm-none-eabi --enable-static --disable-shared

## --------- ##
## Platform. ##
## --------- ##

hostname = dell-Precision-M6400
uname -m = x86_64
uname -r = 4.15.0-39-generic
uname -s = Linux
uname -v = #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2381: checking for a BSD-compatible install
configure:2449: result: /usr/bin/install -c
configure:2460: checking whether build environment is sane
configure:2515: result: yes
configure:2574: checking for arm-none-eabi-strip
configure:2604: result: no
configure:2614: checking for strip
configure:2630: found /usr/bin/strip
configure:2641: result: strip
configure:2666: checking for a thread-safe mkdir -p
configure:2705: result: /bin/mkdir -p
configure:2712: checking for gawk
configure:2742: result: no
configure:2712: checking for mawk
configure:2728: found /usr/bin/mawk
configure:2739: result: mawk
configure:2750: checking whether make sets $(MAKE)
configure:2772: result: yes
configure:2801: checking whether make supports nested variables
configure:2818: result: yes
configure:2905: checking whether to enable maintainer-specific portions of Makefiles
configure:2914: result: no
configure:2952: checking for a sed that does not truncate output
configure:3016: result: /bin/sed
configure:3028: checking whether make sets $(MAKE)
configure:3050: result: yes
configure:3064: checking build system type
configure:3078: result: x86_64-unknown-linux-gnu
configure:3098: checking host system type
configure:3111: result: arm-none-eabi
configure:3146: checking for arm-none-eabi-gcc
configure:3176: result: no
configure:3186: checking for gcc
configure:3202: found /usr/bin/gcc
configure:3213: result: gcc
configure:3442: checking for C compiler version
configure:3451: gcc --version >&5
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3462: $? = 0
configure:3451: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) 
configure:3462: $? = 0
configure:3451: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3462: $? = 1
configure:3451: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:3462: $? = 1
configure:3482: checking whether the C compiler works
configure:3504: gcc -mthumb -mcpu=cortex-m4 -mfloat-abi=hard --specs=nosys.specs   conftest.c  >&5
gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
gcc: error: nosys.specs: No such file or directory
configure:3508: $? = 1
configure:3546: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gsl"
| #define PACKAGE_TARNAME "gsl"
| #define PACKAGE_VERSION "2.5"
| #define PACKAGE_STRING "gsl 2.5"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "gsl"
| #define VERSION "2.5"
| #define RELEASED /**/
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3551: error: in `/home/dell/Hämtningar/gsl-2.5':
configure:3553: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-mthumb -mcpu=cortex-m4 -mfloat-abi=hard --specs=nosys.specs'
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=arm-none-eabi
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=arm-none-eabi
ac_cv_path_SED=/bin/sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=mawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_ac_ct_STRIP=strip
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /home/dell/Hämtningar/gsl-2.5/missing aclocal-1.13'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AS=''
AUTOCONF='${SHELL} /home/dell/Hämtningar/gsl-2.5/missing autoconf'
AUTOHEADER='${SHELL} /home/dell/Hämtningar/gsl-2.5/missing autoheader'
AUTOMAKE='${SHELL} /home/dell/Hämtningar/gsl-2.5/missing automake-1.13'
AWK='mawk'
CC='gcc'
CCDEPMODE=''
CFLAGS='-mthumb -mcpu=cortex-m4 -mfloat-abi=hard --specs=nosys.specs'
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
GSLCBLAS_LDFLAGS=''
GSL_CFLAGS=''
GSL_LDFLAGS=''
GSL_LIBADD=''
GSL_LIBM=''
GSL_LIBS=''
GSL_LT_CBLAS_VERSION='0:0:0'
GSL_LT_VERSION='24:0:1'
GSL_MAJOR_VERSION='2'
GSL_MINOR_VERSION='5'
HAVE_AIX_IEEE_INTERFACE=''
HAVE_DARWIN86_IEEE_INTERFACE=''
HAVE_DARWIN_IEEE_INTERFACE=''
HAVE_FREEBSD_IEEE_INTERFACE=''
HAVE_GNUM68K_IEEE_INTERFACE=''
HAVE_GNUPPC_IEEE_INTERFACE=''
HAVE_GNUSPARC_IEEE_INTERFACE=''
HAVE_GNUX86_IEEE_INTERFACE=''
HAVE_HPUX11_IEEE_INTERFACE=''
HAVE_HPUX_IEEE_INTERFACE=''
HAVE_IRIX_IEEE_INTERFACE=''
HAVE_NETBSD_IEEE_INTERFACE=''
HAVE_OPENBSD_IEEE_INTERFACE=''
HAVE_OS2EMX_IEEE_INTERFACE=''
HAVE_SOLARIS_IEEE_INTERFACE=''
HAVE_SUNOS4_IEEE_INTERFACE=''
HAVE_TRU64_IEEE_INTERFACE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LIBM=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEINFO='${SHELL} /home/dell/Hämtningar/gsl-2.5/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='/bin/mkdir -p'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='gsl'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='gsl'
PACKAGE_STRING='gsl 2.5'
PACKAGE_TARNAME='gsl'
PACKAGE_URL=''
PACKAGE_VERSION='2.5'
PATH_SEPARATOR=':'
RANLIB=''
SED='/bin/sed'
SET_MAKE=''
SHELL='/bin/bash'
STRIP='strip'
VERSION='2.5'
ac_ct_AR=''
ac_ct_CC='gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include=''
am__isrc=''
am__leading_dot='.'
am__nodep=''
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='arm-none-eabi'
host_alias='arm-none-eabi'
host_cpu='arm'
host_os='eabi'
host_vendor='none'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/dell/Hämtningar/gsl-2.5/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "gsl"
#define PACKAGE_TARNAME "gsl"
#define PACKAGE_VERSION "2.5"
#define PACKAGE_STRING "gsl 2.5"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "gsl"
#define VERSION "2.5"
#define RELEASED /**/

configure: exit 77
Mr Andersson
Inlägg: 1409
Blev medlem: 29 januari 2011, 21:06:30
Ort: Lapplandet

Re: Matrisberäkningar med för STM32?

Inlägg av Mr Andersson »

Jag skrev ju att det där var för ARMs kompilator. Byt host till arm-atollic-eabi eller ladda ner ARMs version. Nu försöker den använda intel-gcc eftersom den inte hittar arm-none-eabi.

Edit: Eftersom du verkar köra ubuntu.. Ubuntu har ett paket med arm-none-eabi. Installera INTE det, den fungerar inte korrekt.

Edit2: Ifall du inte lyckas själv. https://mega.nz/#!V3oSRaYT!SYL44XBLMcLl ... h3WqLm7gAw Jag har testat så deras exempel fungerar. Det tar dock extremt mycket flash-plats för det lilla det gör.

Kod: Markera allt

#include <stdio.h>
#include <gsl/gsl_blas.h>

int main(void)
{
	double a[] = {
		1,2,
		3,4
	};

	double b[] = {
		1,2,
		3,4
	};

	double c[] = {
		0.00,
		0.00,
		0.00,
		0.00
	};

	gsl_matrix_view A = gsl_matrix_view_array(a, 2, 2);
	gsl_matrix_view B = gsl_matrix_view_array(b, 2, 2);
	gsl_matrix_view C = gsl_matrix_view_array(c, 2, 2);

	/* Compute C = A B */

	gsl_blas_dgemm(
		CblasNoTrans,
		CblasNoTrans,
		1.0,
		&A.matrix,
		&B.matrix,
		0.0,
		&C.matrix);

	printf("[ %g, %g\n", c[0], c[1]);
	printf("  %g, %g ]\n", c[2], c[3]);

	return 0;
}
1>------------------- Memory utilization report -------------------
1>Used FLASH: 132KB out of 256KB (51%)
1>Used SRAM: 160 bytes out of 40KB (0%)
1>Used CCMRAM: 0 bytes out of 8192 bytes (0%)

132kB för nånting som borde vara max några hundra instruktioner är extremt. Och det är med -Os aktivt.
Användarvisningsbild
Al_Bundy
Inlägg: 2889
Blev medlem: 11 september 2012, 23:59:50
Ort: The U.S - Chicago
Kontakt:

Re: Matrisberäkningar med för STM32?

Inlägg av Al_Bundy »

Förlåt för jag inte var aktiv. Okej. Du verkar ha löst det, och den verkar suga mycket minne. Hmm...man får väll utöka det där C-biblioteket som jag har hittat då.
Användarvisningsbild
mrfrenzy
Co Admin
Inlägg: 15416
Blev medlem: 16 april 2006, 17:04:10

Re: Matrisberäkningar med för STM32?

Inlägg av mrfrenzy »

Å andra sidan, om koden är snabb kanske det inte gör något att den suger mycket flash. Hur mycket behöver du för att få plats med ditt applikationsprogram?
Skriv svar