Sida 7 av 70

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 15:28:29
av AndLi
https://codescracker.com/c/program/c-pr ... trices.htm

Ett litet exempel på hur en matrismultiplikation skulle gå att implementera i C

Kod: Markera allt

/* C Program - Multiply Two Matrices */
		 
#include<stdio.h>
#include<conio.h>
void main()
{
	clrscr();
	int mat1[3][3], mat2[3][3], mat3[3][3], sum=0, i, j, k;
	printf("Enter first matrix element (3*3) : ");
	for(i=0; i<3; i++)
	{
		for(j=0; j<3; j++)
		{
			scanf("%d",&mat1[i][j]);
		}
	}
	printf("Enter second matrix element (3*3) : ");
	for(i=0; i<3; i++)
	{
		for(j=0; j<3; j++)
		{
			scanf("%d",&mat2[i][j]);
		}
	}
	printf("Multiplying two matrices...\n");
	for(i=0; i<3; i++)
	{
		for(j=0; j<3; j++)
		{
			sum=0;
			for(k=0; k<3; k++)
			{
				sum = sum + mat1[i][k] * mat2[k][j];
			}
			mat3[i][j] = sum;
		}
	}
	printf("\nMultiplication of two Matrices : \n");
	for(i=0; i<3; i++)
	{
		for(j=0; j<3; j++)
		{
			printf("%d  ", mat3[i][j]);
		}
		printf("\n");
	}
	getch();
}

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 15:33:01
av säter
Glattnos skrev:En array kan alltså representera en matris.
Jag trodde att array och matris var samma sak?
Men vad vet jag. :)

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 15:36:28
av Al_Bundy
Icecap skrev:Vad jag förstår är ditt nuvarande system utan stabil uppdatering - men du räknar som om att det är.

Detta kan vara orsakad av några saker (eller kombinationer av dom):
* Lag i OS.
* Dålig programmering.
* Dålig samplingssätt.

Windows och Linux är INTE realtids-OS, det finns dock "tillbehör" som kan köra vissa delar i realtid (känd responstid) men det är inte helt enkelt.

Så vill du ha stabil sampling och databehandling ska du antingen göra allt i en enda µC eller ha en realtidskärna. Jag känner till att det finns realtidskärnor men jag har aldrig använd dom.
Självklart är det uC jag ska använda. Men jag vill helst använda GSL eller annat C-liknande bibliotek. Att skriva egna matriser kan resultera rätt ond kod.

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 15:46:47
av Glattnos
säter skrev:
Glattnos skrev:En array kan alltså representera en matris.
Jag trodde att array och matris var samma sak?
Men vad vet jag. :)
Inte helt säker på att det är skillnad men som jag tänkte var att en 1 eller 2-dimensionell array kan representera en matris, men en array kan ju ha ännu fler dimensioner också. Men det kanske en matris också kan ha :)

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 16:16:41
av sodjan
En "array" är ju bara en teknisk representation av en "matris".
Sen så har ju inte (t.ex.) C någon inbyggt stöd för att göra de
speciella matrisoperationerna, utan bibliotek som de som nämnts.

Och ja, en array (eller en matris) kan ha valfritt antal dimensioner.

Så om man betraktar det som en vanlig "array" eller som en "matris"
har mer med vad man tänker göra med det, än hur det lagras tekniskt.

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 17:30:24
av SvenW
Att skriva egna matriser kan resultera rätt ond kod.
Här menar du säkert matrisoperationer. Matrismultiplikation, invertering, determinatberäkning etc.

Men att skriva den koden i C, eller valfritt språk, är inte speciellt svårt.
Finns massor av exemplel om man googlar. Man kan också titta i GSL hur man gör. Eller i källkoden för Octave (troligen Fortran).

I CMSIS, som finns för STM32, finns några av de vanligaste matrisoperationerna.

Skall man sedan använda matrisalgoritmer i praktiken som i en reglerloop, är det en stor chans att man vill förenkla. Stora matriser kräver mycket beräkningskapacitet.

Ofta är matrisformulering av ett problem av akademisk karaktär, dvs formalismen blir minimal samtidigt som numeriska beräkningarna blir krävande.
Inte alltid vad man önskar sig i en enkel elektronikpryl.

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 19:04:37
av Al_Bundy
Jo. Men detta bibliotek är fattigt som jag skrev i första post. Bundy ska ju ha det bästa 8)

Nu skulle jag behöva lite hjälp. Jag har laddat ned GSL och packat upp detta. Sedan har jag installerat det.

Kod: Markera allt

./configure --prefix=/vägen/där/jag/vill/installera/gsl
make
make check
make install
Svårare än så var det inte att installera GSL. Hur som helst. Nu har jag importerar detta. Resultatet blev att jag kunde inkludera biblioteket.
Markering_026.png
Men ändå begriper sig utvecklingsverktyget inte på detta. Jag måste ha missat något.
Markering_027.png
Jag tänkte köra detta exempel.

Kod: Markera allt

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

int
main (void)
{
  double x = 5.0;
  double y = gsl_sf_bessel_J0 (x);
  printf ("J0(%g) = %.18e\n", x, y);
  return 0;
}
Här är en lista på alla mina filer.
dell@dell-Precision-M6400:~/program$ find *
GSL
GSL/include
GSL/include/gsl
GSL/include/gsl/gsl_bspline.h
GSL/include/gsl/gsl_vector_ushort.h
GSL/include/gsl/gsl_permute_vector_ushort.h
GSL/include/gsl/gsl_sf_sincos_pi.h
GSL/include/gsl/gsl_block_complex_float.h
GSL/include/gsl/gsl_filter.h
GSL/include/gsl/gsl_nan.h
GSL/include/gsl/gsl_multilarge_nlinear.h
GSL/include/gsl/gsl_fft_halfcomplex_float.h
GSL/include/gsl/gsl_monte.h
GSL/include/gsl/gsl_sf_elementary.h
GSL/include/gsl/gsl_fft_real.h
GSL/include/gsl/gsl_roots.h
GSL/include/gsl/gsl_histogram2d.h
GSL/include/gsl/gsl_statistics_uchar.h
GSL/include/gsl/gsl_block_long_double.h
GSL/include/gsl/gsl_sf_dawson.h
GSL/include/gsl/gsl_vector_complex_float.h
GSL/include/gsl/gsl_blas_types.h
GSL/include/gsl/gsl_sys.h
GSL/include/gsl/gsl_sf_clausen.h
GSL/include/gsl/gsl_permute_int.h
GSL/include/gsl/gsl_block_complex_double.h
GSL/include/gsl/gsl_permute_vector_char.h
GSL/include/gsl/gsl_permute_complex_double.h
GSL/include/gsl/gsl_permute_matrix_uint.h
GSL/include/gsl/gsl_permute_vector_long.h
GSL/include/gsl/gsl_sum.h
GSL/include/gsl/gsl_blas.h
GSL/include/gsl/gsl_monte_miser.h
GSL/include/gsl/gsl_sf_result.h
GSL/include/gsl/gsl_permute_complex_float.h
GSL/include/gsl/gsl_sort_float.h
GSL/include/gsl/gsl_multifit_nlin.h
GSL/include/gsl/gsl_sort_vector_float.h
GSL/include/gsl/gsl_matrix_short.h
GSL/include/gsl/gsl_vector_ulong.h
GSL/include/gsl/gsl_sf_zeta.h
GSL/include/gsl/gsl_version.h
GSL/include/gsl/gsl_dht.h
GSL/include/gsl/gsl_sf_pow_int.h
GSL/include/gsl/gsl_permute_uint.h
GSL/include/gsl/gsl_sort_ulong.h
GSL/include/gsl/gsl_statistics_long_double.h
GSL/include/gsl/gsl_movstat.h
GSL/include/gsl/gsl_check_range.h
GSL/include/gsl/gsl_block_int.h
GSL/include/gsl/gsl_sort_vector_long_double.h
GSL/include/gsl/gsl_sort_uint.h
GSL/include/gsl/gsl_combination.h
GSL/include/gsl/gsl_permute_vector_ulong.h
GSL/include/gsl/gsl_siman.h
GSL/include/gsl/gsl_rng.h
GSL/include/gsl/gsl_specfunc.h
GSL/include/gsl/gsl_block_uint.h
GSL/include/gsl/gsl_splinalg.h
GSL/include/gsl/gsl_permute_matrix_long_double.h
GSL/include/gsl/gsl_permute_vector_short.h
GSL/include/gsl/gsl_sort_vector_ulong.h
GSL/include/gsl/gsl_matrix_ushort.h
GSL/include/gsl/gsl_sort_int.h
GSL/include/gsl/gsl_matrix_double.h
GSL/include/gsl/gsl_permute_float.h
GSL/include/gsl/gsl_minmax.h
GSL/include/gsl/gsl_const.h
GSL/include/gsl/gsl_sf_legendre.h
GSL/include/gsl/gsl_block_long.h
GSL/include/gsl/gsl_vector_long.h
GSL/include/gsl/gsl_matrix_ulong.h
GSL/include/gsl/gsl_sf_laguerre.h
GSL/include/gsl/gsl_multilarge.h
GSL/include/gsl/gsl_linalg.h
GSL/include/gsl/gsl_complex_math.h
GSL/include/gsl/gsl_sf_fermi_dirac.h
GSL/include/gsl/gsl_matrix_char.h
GSL/include/gsl/gsl_permute_matrix_long.h
GSL/include/gsl/gsl_vector_complex_double.h
GSL/include/gsl/gsl_machine.h
GSL/include/gsl/gsl_permute_matrix_complex_long_double.h
GSL/include/gsl/gsl_sf_lambert.h
GSL/include/gsl/gsl_sf_exp.h
GSL/include/gsl/gsl_vector_float.h
GSL/include/gsl/gsl_permute_vector_complex_double.h
GSL/include/gsl/gsl_histogram.h
GSL/include/gsl/gsl_matrix_complex_double.h
GSL/include/gsl/gsl_permute_matrix_complex_double.h
GSL/include/gsl/gsl_eigen.h
GSL/include/gsl/gsl_sf_coulomb.h
GSL/include/gsl/gsl_sf_expint.h
GSL/include/gsl/gsl_randist.h
GSL/include/gsl/gsl_block_uchar.h
GSL/include/gsl/gsl_statistics_double.h
GSL/include/gsl/gsl_sort_vector_double.h
GSL/include/gsl/gsl_const_cgs.h
GSL/include/gsl/gsl_sf_gegenbauer.h
GSL/include/gsl/gsl_const_cgsm.h
GSL/include/gsl/gsl_permute_ushort.h
GSL/include/gsl/gsl_sort_long_double.h
GSL/include/gsl/gsl_permute_short.h
GSL/include/gsl/gsl_statistics_ulong.h
GSL/include/gsl/gsl_poly.h
GSL/include/gsl/gsl_permute_ulong.h
GSL/include/gsl/gsl_block_float.h
GSL/include/gsl/gsl_sf_trig.h
GSL/include/gsl/gsl_wavelet.h
GSL/include/gsl/gsl_diff.h
GSL/include/gsl/gsl_sort_vector_uchar.h
GSL/include/gsl/gsl_statistics_long.h
GSL/include/gsl/gsl_qrng.h
GSL/include/gsl/gsl_chebyshev.h
GSL/include/gsl/gsl_sort_double.h
GSL/include/gsl/gsl_matrix_float.h
GSL/include/gsl/gsl_matrix_int.h
GSL/include/gsl/gsl_test.h
GSL/include/gsl/gsl_ntuple.h
GSL/include/gsl/gsl_permute_matrix_uchar.h
GSL/include/gsl/gsl_statistics_uint.h
GSL/include/gsl/gsl_sort_long.h
GSL/include/gsl/gsl_vector_uint.h
GSL/include/gsl/gsl_permute.h
GSL/include/gsl/gsl_dft_complex_float.h
GSL/include/gsl/gsl_complex.h
GSL/include/gsl/gsl_const_mks.h
GSL/include/gsl/gsl_block_ushort.h
GSL/include/gsl/gsl_permute_vector_uint.h
GSL/include/gsl/gsl_block_double.h
GSL/include/gsl/gsl_multiset.h
GSL/include/gsl/gsl_sf_hyperg.h
GSL/include/gsl/gsl_multifit.h
GSL/include/gsl/gsl_permute_vector_double.h
GSL/include/gsl/gsl_fft.h
GSL/include/gsl/gsl_interp.h
GSL/include/gsl/gsl_block_short.h
GSL/include/gsl/gsl_vector.h
GSL/include/gsl/gsl_sf_log.h
GSL/include/gsl/gsl_matrix_complex_float.h
GSL/include/gsl/gsl_permute_matrix_char.h
GSL/include/gsl/gsl_odeiv.h
GSL/include/gsl/gsl_statistics_float.h
GSL/include/gsl/gsl_math.h
GSL/include/gsl/gsl_vector_int.h
GSL/include/gsl/gsl_vector_complex_long_double.h
GSL/include/gsl/gsl_permute_char.h
GSL/include/gsl/gsl_mode.h
GSL/include/gsl/gsl_statistics_short.h
GSL/include/gsl/gsl_permute_long_double.h
GSL/include/gsl/gsl_spline.h
GSL/include/gsl/gsl_sort_ushort.h
GSL/include/gsl/gsl_fft_real_float.h
GSL/include/gsl/gsl_multimin.h
GSL/include/gsl/gsl_sort_vector_int.h
GSL/include/gsl/gsl_sort_uchar.h
GSL/include/gsl/gsl_sf.h
GSL/include/gsl/gsl_sf_bessel.h
GSL/include/gsl/gsl_permute_vector.h
GSL/include/gsl/gsl_vector_short.h
GSL/include/gsl/gsl_sf_erf.h
GSL/include/gsl/gsl_vector_char.h
GSL/include/gsl/gsl_permute_vector_long_double.h
GSL/include/gsl/gsl_types.h
GSL/include/gsl/gsl_sort_char.h
GSL/include/gsl/gsl_permute_matrix_short.h
GSL/include/gsl/gsl_deriv.h
GSL/include/gsl/gsl_integration.h
GSL/include/gsl/gsl_const_mksa.h
GSL/include/gsl/gsl_min.h
GSL/include/gsl/gsl_sf_coupling.h
GSL/include/gsl/gsl_sf_mathieu.h
GSL/include/gsl/gsl_sort_short.h
GSL/include/gsl/gsl_heapsort.h
GSL/include/gsl/gsl_sf_dilog.h
GSL/include/gsl/gsl_sort_vector_ushort.h
GSL/include/gsl/gsl_permute_matrix_float.h
GSL/include/gsl/gsl_statistics_int.h
GSL/include/gsl/gsl_fft_complex.h
GSL/include/gsl/gsl_inline.h
GSL/include/gsl/gsl_permute_vector_float.h
GSL/include/gsl/gsl_permute_long.h
GSL/include/gsl/gsl_ieee_utils.h
GSL/include/gsl/gsl_fit.h
GSL/include/gsl/gsl_sf_elljac.h
GSL/include/gsl/gsl_matrix.h
GSL/include/gsl/gsl_interp2d.h
GSL/include/gsl/gsl_sf_debye.h
GSL/include/gsl/gsl_sf_synchrotron.h
GSL/include/gsl/gsl_sf_ellint.h
GSL/include/gsl/gsl_block_ulong.h
GSL/include/gsl/gsl_fft_complex_float.h
GSL/include/gsl/gsl_sort_vector_char.h
GSL/include/gsl/gsl_statistics.h
GSL/include/gsl/gsl_monte_plain.h
GSL/include/gsl/gsl_permute_double.h
GSL/include/gsl/gsl_block_complex_long_double.h
GSL/include/gsl/gsl_block.h
GSL/include/gsl/gsl_sf_airy.h
GSL/include/gsl/gsl_matrix_complex_long_double.h
GSL/include/gsl/gsl_const_num.h
GSL/include/gsl/gsl_multifit_nlinear.h
GSL/include/gsl/gsl_matrix_long.h
GSL/include/gsl/gsl_monte_vegas.h
GSL/include/gsl/gsl_permute_matrix_double.h
GSL/include/gsl/gsl_statistics_ushort.h
GSL/include/gsl/gsl_message.h
GSL/include/gsl/gsl_spblas.h
GSL/include/gsl/gsl_statistics_char.h
GSL/include/gsl/gsl_vector_double.h
GSL/include/gsl/gsl_precision.h
GSL/include/gsl/gsl_permute_matrix_ushort.h
GSL/include/gsl/gsl_sort_vector_short.h
GSL/include/gsl/gsl_sf_gamma.h
GSL/include/gsl/gsl_rstat.h
GSL/include/gsl/gsl_sf_psi.h
GSL/include/gsl/gsl_permute_matrix_ulong.h
GSL/include/gsl/gsl_pow_int.h
GSL/include/gsl/gsl_permute_vector_int.h
GSL/include/gsl/gsl_block_char.h
GSL/include/gsl/gsl_sort_vector.h
GSL/include/gsl/gsl_dft_complex.h
GSL/include/gsl/gsl_fft_halfcomplex.h
GSL/include/gsl/gsl_sort_vector_long.h
GSL/include/gsl/gsl_multiroots.h
GSL/include/gsl/gsl_permute_matrix_int.h
GSL/include/gsl/gsl_sf_transport.h
GSL/include/gsl/gsl_permute_uchar.h
GSL/include/gsl/gsl_permute_vector_uchar.h
GSL/include/gsl/gsl_sort.h
GSL/include/gsl/gsl_sort_vector_uint.h
GSL/include/gsl/gsl_cblas.h
GSL/include/gsl/gsl_permute_vector_complex_long_double.h
GSL/include/gsl/gsl_permute_vector_complex_float.h
GSL/include/gsl/gsl_vector_uchar.h
GSL/include/gsl/gsl_errno.h
GSL/include/gsl/gsl_permute_matrix.h
GSL/include/gsl/gsl_wavelet2d.h
GSL/include/gsl/gsl_spmatrix.h
GSL/include/gsl/gsl_vector_complex.h
GSL/include/gsl/gsl_permutation.h
GSL/include/gsl/gsl_cdf.h
GSL/include/gsl/gsl_odeiv2.h
GSL/include/gsl/gsl_matrix_uchar.h
GSL/include/gsl/gsl_matrix_uint.h
GSL/include/gsl/gsl_permute_complex_long_double.h
GSL/include/gsl/gsl_spline2d.h
GSL/include/gsl/gsl_vector_long_double.h
GSL/include/gsl/gsl_sf_hermite.h
GSL/include/gsl/gsl_permute_matrix_complex_float.h
GSL/include/gsl/gsl_matrix_long_double.h
GSL/bin
GSL/bin/gsl-config
GSL/bin/gsl-randist
GSL/bin/gsl-histogram
GSL/share
GSL/share/info
GSL/share/info/gsl-ref.info
GSL/share/aclocal
GSL/share/aclocal/gsl.m4
GSL/share/man
GSL/share/man/man1
GSL/share/man/man1/gsl-randist.1
GSL/share/man/man1/gsl-config.1
GSL/share/man/man1/gsl-histogram.1
GSL/share/man/man3
GSL/share/man/man3/gsl.3
GSL/lib
GSL/lib/libgslcblas.so.0.0.0
GSL/lib/pkgconfig
GSL/lib/pkgconfig/gsl.pc
GSL/lib/libgsl.a
GSL/lib/libgsl.so
GSL/lib/libgslcblas.a
GSL/lib/libgslcblas.so
GSL/lib/libgsl.la
GSL/lib/libgsl.so.23
GSL/lib/libgslcblas.so.0
GSL/lib/libgsl.so.23.1.0
GSL/lib/libgslcblas.la
dell@dell-Precision-M6400:~/program$

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 19:24:38
av SvenW
Jag misstänker att du installerat ett bibliotek avsett att köras på din PC.
Du vill väL köra på STM32 ??
I så fall måste du kompilera hela biblioteket med kompilatorn för ARM.
Det är inte samma som för Intel eller AMD !!
GCC kan gå för båda, men varianterna är olika.

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 19:40:03
av AndLi
Precis som SvenW säger så har du ett lib för din PC, det kan du lätt kolla genom att göra en "file libnamnet"
Du behöver korskompilera det för arm, och då behöver du ladda ner alla .c filer också och inte bara headers som du gjort nu.

Du måste också ange i din makefil att gcc ska använda ditt lib, det räcker inte bara att lägga till en path.

Intressant är väl egentligen outputen från gcc när du bygger.

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 20:04:22
av Al_Bundy
Så när jag kompilerar med "make" kommandot, då måste jag skriva

Kod: Markera allt

make cross_compile="arkitektur"
Vad kan det vara för arkitektur om man kör STM32?

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 20:09:40
av AndLi
Vad heter din gcc compilator för stm32, det kan ge en hint..
Eller titta vad cross_compile används till i Makefile

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 20:13:38
av AndLi
För att korskompilera GSL för en raspberry ska man köra

Kod: Markera allt

./configure --host=armv6j-hardfloat-linux-gnueabi --build=x86_64-pc-linux-gnu --target=armv6j-hardfloat-linux-gnueabi \
CFLAGS="-march=armv6 -mfloat-abi=hard -mfpu-vfp"
Men det är ju alla exempel när man kör med linux på target med, frågan om det inte skiljer sig när man bygger ett lib för ett barebone system som du kör på STM32an..

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 20:18:38
av SvenW
Vill tillägga att jag tror det det här korskompileringsprojektet kan bli en aning Herkuleanskt.
Dock intressant för oss alla, speciellt om det lyckas!!!
Så forsätt gärna ett tag till!

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 20:20:17
av Al_Bundy
Så här står det när jag bygger i TrueSTUDIO.

Kod: Markera allt

20:17:43 **** Rebuild of configuration Debug for project USB-IO ****
Info: Internal Builder is used for build
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Src/system_stm32f4xx.o ../Src/system_stm32f4xx.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Src/stm32f4xx_it.o ../Src/stm32f4xx_it.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Src/stm32f4xx_hal_msp.o ../Src/stm32f4xx_hal_msp.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Src/main.o ../Src/main.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g -Wa,--no-warn -x assembler-with-cpp -specs=nano.specs -o startup/startup_stm32f401xe.o ../startup/startup_stm32f401xe.s 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c 
arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F401xE -I../Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.o ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c 
arm-atollic-eabi-gcc -o USB-IO.elf Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.o Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.o Src/main.o Src/stm32f4xx_hal_msp.o Src/stm32f4xx_it.o Src/system_stm32f4xx.o startup/startup_stm32f401xe.o -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -T../STM32F401RE_FLASH.ld -specs=nosys.specs -static -Wl,-Map=USB-IO.map -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs 
/home/asus/Program/TrueStudio/ide/jre/bin/java -jar /home/asus/Program/TrueStudio/Tools/arm-atollic-reports.jar sizeinfo list USB-IO.elf 
Generate build reports...
Print size information
   text	   data	    bss	    dec	    hex	filename
  11876	    120	   2008	  14004	   36b4	USB-IO.elf
Print size information done
Generate listing file
Output sent to: USB-IO.list
Generate listing file done
Generate build reports done
arm-atollic-eabi-objcopy -O ihex USB-IO.elf USB-IO.hex 

20:17:59 Build Finished (took 15s.582ms)
Kanske man ska skriva i så här istället.

Kod: Markera allt

make CROSS_COMPILE=arm-atollic-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=gnu11
Eller?

Edit:
Här är svaret. https://electronics.stackexchange.com/q ... for-nucleo

Re: Matrisberäkningar med för STM32?

Postat: 9 januari 2019, 20:30:26
av AndLi
Fast frågan är om du inte behöver köra ./configure i din GSL katalog för att den ska sätta upp allt rätt med dina förutsättningar. (Med lämpliga switchar till ./configure)