Forum: Projekte & Code STM32F4Discovery mit CooCox CoOS-RTOS und printf


von Peter S. (psavr)


Angehängte Dateien:

Lesenswert?

STM32F4Discovery Beispiel-Projekt für CooCoox CoIDE V-1.5.2

*====================================================================
* @author  psavr(at)gmx.ch
* @version V1.0
* @date    17-Oktober-2012
* @brief   Demo-Application for STM32F4-Discovery Board
*          including RTOS CoOS V1.1.4 (2011.04.20)
*          including printf() for USART2 (=Default) or USART3
*====================================================================
* This Example is maintained under the PsAvr "BEERWARE-LICENSE"
* Feel free to use it, to modify it and to distribute it. If you like
* it and we meet us once in a pub or a bar, you may to spend me a beer!
*
* I would appreciate it very much, if you would return any corrections
* and/or improvements back to me and/or to the CooCox community.
*====================================================================
* todo: Test mit HW-FPU bzw. FPU-Register beim Taskwechsel sichern!
*====================================================================

von Thomas (Gast)


Lesenswert?

Super, vielen Dank! Ist genau was ich brauche und läuft auf "Anhieb".

von Rene B. (themason) Benutzerseite


Lesenswert?

>* This Example is maintained under the PsAvr "BEERWARE-LICENSE"
>* Feel free to use it, to modify it and to distribute it. If you like
>* it and we meet us once in a pub or a bar, you may to spend me a beer!

Dieser Lizenztyp ist mir mal auf Anhieb 100% sympathisch. Bin dafür das 
zur Standardlizenz zu machen :-)

BTW. Schonmal danke vorab für den Codesnippet. Hab heute mein Discovery 
bekommen. Mal schauen wann ich Zeit finde damit rumzuspielen. :-)

von Peter S. (psavr)


Angehängte Dateien:

Lesenswert?

Anbei ein Update mit einigen Erweiterungen (I2C-Bus) und vielen 
Verbesserungen (z.B. UART mit RX+TX ISR)
1
/************************************************************************
2
 * @file    main.c
3
 * @author  psavr@gmx.ch
4
 * @version V01.10
5
 * @date    21-November-2012
6
 * @brief   Demo-Application for STM32F4-Discovery Board
7
 *          including RTOS CoOS V1.1.4 (2011.04.20)
8
 *          including USART module for printf() on USART2, USART3 or USART6
9
 *          including command shell for terminal on USART6 at 115200-8-N-1
10
 *          including generic I2C functions
11
 ************************************************************************
12
 * @attention
13
 *
14
 * This Example is maintained under the PsAvr "BEERWARE-LICENSE"
15
 * Feel free to use it, to modify it and to distribute it. If you like
16
 * it and we meet us once in a pub or a bar, feel free to spend me a beer!
17
 *
18
 * I would appreciate it very much, if you would return any corrections
19
 * and/or improvements back to me and/or to the CooCox community.
20
 ************************************************************************/

Link: Falls jemand sein STM32F4-Discovery mit einem I2C-Bus EEPROM 
aufrüsten will: Beitrag "STM32F4 Discovery mit I2C-Bus EEPROM"


*Terminal-Output:
1
---------------------------------------
2
STM32F4-Discovery Board is booting!
3
CoOS RTOS V-1.1.4; Demo for STM32F4
4
---------------------------------------
5
CoOS RTOS: Creating tasks
6
CoOS RTOS: Starting scheduler
7
CoOS taskA: started
8
CoOS taskB: started
9
CoOS taskC: started
10
CoOS taskD: started
11
12
=======================================
13
 Welcome on the Terminal-Command-Shell
14
---------------------------------------
15
 ***    STM32F4-Discovery Board    ***
16
 ***      (w) by Peter Sager       ***
17
---------------------------------------
18
 *** V01.10; Nov 21 2012; 22:14:43 ***
19
=======================================
20
>
21
>Help
22
==================================================================
23
 RB &addr [n]                   - read n bytes from memory(addr)
24
 RW &addr [n]                   - read n words from memory(addr)
25
 RL &addr [n]                   - read n longs from memory(addr)
26
 WB &addr &val1 [&val2]..       - write 1..n bytes to memory(addr)
27
 WW &addr &val1 [&val2]..       - write 1..n words to memory(addr)
28
 WL &addr &val1 [&val2]..       - write 1..n longs to memory(addr)
29
-------------------------------------------------------------------
30
 RB &addr S                     - read a string  from memory(addr)
31
 WB &addr 'string'              - write a string to memory(addr)
32
-------------------------------------------------------------------
33
 RI &addr[:&ptr] [n]            - read n bytes from I2C-Bus
34
 RI &addr[:&ptr] S              - read a string from I2C-Bus
35
 WI &addr[:&ptr] &val..         - write a byte array to I2C-Bus
36
 WI &addr[:&ptr] 'string'       - write a string to I2C-Bus
37
-------------------------------------------------------------------
38
 TCI ON/OFF                     - trace command info [on/off]
39
 VER                            - display version
40
 HELP                           - display this help
41
 RESET                          - Reboot the board
42
==================================================================
43
>

von Peter S. (psavr)


Angehängte Dateien:

Lesenswert?

Update zum 2ten...

von Peter S. (psavr)


Angehängte Dateien:

Lesenswert?

Update zum 3ten, mit säuberlich aufgeräumter #include Struktur...

von Thomas R. (Gast)


Lesenswert?

Danke, funktioniert auf Anhieb wunderbar und ist ein sehr hilfreicher 
CoOS-Einstieg!

---------------------------------------
STM32F4-Discovery Board is booting!
CoOS RTOS V-1.1.4; Demo for STM32F4
---------------------------------------
CoOS RTOS: Creating tasks
CoOS RTOS: Starting scheduler
CoOS taskA: started
CoOS taskB: started
CoOS taskC: started
CoOS taskD: started

=======================================
 Welcome on the Terminal-Command-Shell
---------------------------------------
 ***    STM32F4-Discovery Board    ***
 ***      (w) by Peter Sager       ***
---------------------------------------
 *** V02.00; Nov 23 2012; 08:23:04 ***
=======================================

von Fritz (Gast)


Lesenswert?

Besten Dank für deinen Code.
Dazu habe ich eine Frage:
Du verwendest darin CoOS-RTOS. Ist das schon an die FPU der STM32F4xx 
angepasst, sprich werden beim initialisieren die 
stack-save-möglichkeiten der FPU-register festgelegt und dann auch beim 
Contexswitch entsprechend genutzt?
Oder hast du das CoOS so genommen wie es ist und man kann also die FPU 
sicher nur in einer task verwenden?

von Peter S. (psavr)


Lesenswert?

>Du verwendest darin CoOS-RTOS. Ist das schon an die FPU der STM32F4xx
>angepasst.
Nein, ist leider noch ohne FPU Unterstützung, bzw. die FPU dürfte nur 
für einen Task verwendet werden. Ich frag mich aber ob man das wirklich 
unter Kontrolle hat? Wenn man dem Compiler die FPU freigibt, wird der 
vermutlich schon bei einem printf mit float-Zahlen automatisch Code für 
die FPU generieren.

Wäre natürlich toll, wenn jemand dieses CoOS-Projekt FPU-tauglich 
hinkriegt, oder es mit einem anderen RTOS kombiniert, z.B. FreeRTOS, 
uCOS, oder RTX (von Keil)und dann den Code ebenfalls hier posten würde. 
Wobei ich mich frage, ob diese anderen RTOS bereits FPU-tauglich sind? 
Ich fürchte nicht...

von Peter S. (psavr)


Lesenswert?

Mein Discovery steckt übrigens auf einem STF4BB Baseboard:
http://www.embedinfo.com/English/download/DM-STF4BB.pdf
Da hat's unter anderem Ethernet-Phy mit RJ45-Stecker , ein RS232-Treiber 
und ein Mikro-SD Card Interface.

Falls jemand meinem "Projekt" etwas beisteuern mag, ich wäre an 
folgenden CoIDE Erweiterungen interessiert:

- SD-Card Unterstützung (mit Filesystem)
- Ethernet (z.B. lWIP e.v. mit WEB-Server)
- RTOS mit FPU-Unterstützung, (kann auch was anderes als CoOS sein)

von Werner P. (Gast)


Lesenswert?

@Peter

wo hast Du das Board her. Hab schon gegoogelt aber kann keinen deutschen 
Lieferanten finden.

von Peter S. (psavr)


Lesenswert?

@Werner P.
Ich hab's direkt im Webshop von embedinfo online bestellt. (2 Stk. 
zusammen mit dem Discovery-Board für total USD $110)

http://www.embedinfo.com/english/product/DM-STF4BB.asp

Die Ware kam dann innert 10 Tagen per Fedex-Express direkt aus China. 
Leider betragen die Versandkosten zusätzlich ca. 30 €, daher ist eine 
Sammelbestellung sehr lohnenswert.

von Peter S. (psavr)


Angehängte Dateien:

Lesenswert?

Update...

von Jörg B. (joerg-sh)


Lesenswert?

Hallo Peter,
hat sich schon was in Zusammenhang mit FPU Nutzung getan?

Grüße

Jörg

von Denis-Yves K. (moviemakers)


Lesenswert?

Hab dein Projekt ausprobiert, hat auf Anhieb funktioniert, danke, super 
Einstieg!

Grüße, Denis.

von Denis-Yves K. (moviemakers)



Lesenswert?

Ich durfte bei meiner Firma mit dem STM32 im Zuge einer Ferienarbeit 
dein Beispiel mit einem LwIP Stack inklusive Webserver erweitern. Der 
SourceCode hierfür stammt von dieser Seite: 
http://kpy3ep.de.tl/stm32f4-discovery-mit-ethernet.htm
Zur Funktion:
Ihr braucht ein STM32 Discovery Board mit dem STMF4BB Base Board und 
einen Test-PC dessen IP Adresse ihr statisch auf z.B 192.168.0.100 
konfiguriert (Subnetz 255.255.255.0 und STD-Gateway 192.168.2.1). 
Verbindet beide Stellen über zwei Patchkabel mit einem Switch. 
Kompiliert und ladet das Beispiel mit CooCox auf das Board und gebt dann 
im Browser 192.168.0.10 ein. Es wird sich die Startseite des Webservers 
öffnen.
Ihr habt die Möglichkeit LEDs ein/auszuschalten und ADC-Werte auszulesen 
und außerdem UART Nachrichten zu schicken (CGI-Handler und SSI Handler). 
Allerdings wird der empfangene String an einem Terminal erst nach senden 
eines Carriage Return + Line Feed angezeigt, da nach wie vor die 
ürsprüngliche UART Shell in Betrieb ist....

Ich hoffe ihr erweitert dieses Beispiel (z.B. oben erwähnte SD 
Karten-Unterstützung (FAT) oder ein kleines USB Beispiel) und stellt 
eure Ergebnisse der Community zu Verfügung.

Grüße, Denis.

von Peter S. (psavr)


Lesenswert?

Hallo Denis

Vielen Dank, dass Du den erweiterten Code hier wieder der Allgemeinheit 
zur Verfügung stellst, ist schön zu sehen, dass das Projekt noch "lebt"!

Gruss Peter

von Frank A. (_frank)


Lesenswert?

Hallo Peter,

vielen Dank für dein Projekt, werde es gleich mal ausprobieren.
Habe mir neben dem BaseBoard auch das LCD gekauft. Hast du das schon 
einmal ausprobiert?

Habe unter Atollic ein Beispiel zur Kalibrierung ans laufen bekommen. 
BMPs anzeigen läuft auch.
Bin gerade dabei die Embedded GUI Library von ST zu integrieren. Lande 
z.Z. nur immer HardFault_Handler. Komme noch nicht ganz dahinter was der 
Fehler ist.
Was für die Zukunft richtig interessant ist, ist die STemWin Library. 
Die hatte ST auf der Embedded 2013 angekündigt und ist jetzt verfügbar. 
Wenn ich Zeit habe und die andere Library läuft versuche ich mal die zu 
integrieren.

Wenn ich das in den nächsten Tagen noch etwas zum Laufen bekomme, hoffe 
ich das ich hier etwas beisteuern kann.

Gruß Frank

von Figlux E. (Firma: figlux electronix) (fuxl)


Lesenswert?

Wenn du das Projekt hier veröffentlichen könntest wäre ich sehr 
interessiert daran! habe auch das Baseboard sowie das TFT.

von Frank A. (_frank)


Lesenswert?

Hallo,

leider bin ich aus Zeitmangel noch nicht viel weiter gekommen.
Den Fehler mit dem Hardfault habe ich beseitigt.
Leider zeigt er mir den erstellten Screen noch nicht richtig an. 
Schriften funktionieren, Bilder und Buttons leider noch nicht.
Hoffe das ich zum Wochenende etwas Zeit finde.

von jim (Gast)


Lesenswert?

Hi I am having problem printing float variables using printf when I do 
it from a CoOs task. When I do this I endup in CoStkOverflowHook. If I 
do a printf of a float variable before I start the os there are no 
problems. Why is this and how do I solve it. The same problem happens 
when I try using sprintf.

If I increase the task stack size to 2048 the program does not crash but 
the print out of the float always gives me: -0.00000 which is incorrect.

I am using CoOs V1.1.4 on a STM32F4-Discovery Board with CoIDE 1.7.5, 
GCC 4.7 2013q3 and soft FPU

Works:
int main(void)
{
  UART_Init();
  I2C_BusInit();
  LED_Init();
  double floatTest;
  printf("\n---------------------------------------\n");
  printf("STM32F4-Discovery Board is booting!\n");
  printf("CoOS RTOS V-1.1.4; Demo for STM32F4\n");
  printf("---------------------------------------\n");
  UART_Flush();  // wait until UART-Buffer is empty

  floatTest = 400 * 0.123;
  printf("CoOS taskB: floatTest = %f\n", floatTest); //printing float 
here works

Does not work:
void taskB(void* pdata)
{
  unsigned int b = 0;
  double floatTest;
  char buffer[200];
  printf("CoOS taskB: started\n");
  while (1)
  {
    if (b & 1)
    {
      GPIO_SetBits(GPIOD, GPIO_Pin_13);
    } else
    {
      GPIO_ResetBits(GPIOD, GPIO_Pin_13);
      floatTest = 400 * 0.123;

   //  printf("CoOS taskB: floatTest = %f\n", floatTest); //printing 
float here does not work
    if( floatTest == 0)//Preventing floatTest from being optimized away
    {
      GPIO_SetBits(GPIOD, GPIO_Pin_13);
    }
//    sprintf(buffer, "%f   = " , floatTest );
  //  printf("CoOS taskB: buffer = %s\n", buffer);
    }
    b++;
    CoTickDelay(50); //50 x 10ms = 500ms

  }
}

Anyone having an idea what’s going on here?

Here is my project:
https://www.dropbox.com/s/hgdry3cuv5tqdht/STM32F4_Discovery_CoOS.rar

von Peter S. (psavr)


Angehängte Dateien:

Lesenswert?

Ich hatte endlich wieder mal etwas Zeit mit meinem STM32F4-Discovery zu 
spielen und habe von CooCox auf Eclipse umgestellt.

Eclipse: eclipse-cpp-luna-M4-win32.zip

GCC:     gcc-arm-none-eabi-4_8-2013q4
         https://launchpad.net/gcc-arm-embedded
         ==> "Cross Build Tools" für Windows
         ==> http://gnuarmeclipse.livius.net/blog/build-tools-windows/

Plugin:  ilg.gnuarmeclipse.repository-1.1.7
         http://gnuarmeclipse.livius.net/blog/use/

ST-Link: stlink-20130324-win STLINK v0.5.6 for Windows
         http://www.emb4fun.de/archive/stlink/index.html

Anbei das "alte" Projekt von mir und jenes mit der Webserver-Erweiterung 
von Denis-Yves Kökeny als Eclipse-Projekte:

von Peter S. (psavr)


Angehängte Dateien:

Lesenswert?

Anbei noch ein Update mit aktueller Version der STM32F4xxx 
StandardPeripheralsLib + CMSIS (beide V-1.3.0 / 8. November 2013)

==> STM32F4_Discovery.zip

Das Update ist aber eher kosmetischer Natur, müsste keinen Einfluss 
haben auf das Projekt.


Die beiden Verzeichnisse \StdPeriph und \CMSIS können ohne Änderungen 
auch ins "STM32F4_Discovery_lwIP" Projekt kopiert werden, ich habe 
dieses jetzt nicht noch extra hochgeladen.

: Bearbeitet durch User
von geizhals (Gast)


Lesenswert?

Hallo


ich bin gerade dabei dieses beispiel zu erweitern für das stm32f4 
baseboard + dem 3.5" tft/touch!
ich habe von dem beispiel von der st hp die lcd lib verwendet .. 
allerdings beim compilieren besser gesagt beim Linken gibt es Fehler?
1
GCC HOME: C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q2\bin
2
compile:
3
    [mkdir] Created dir: C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\STM32F4_Discovery_CoOS\Debug\bin
4
    [mkdir] Created dir: C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\STM32F4_Discovery_CoOS\Debug\obj
5
       [cc] 36 total files to be compiled.
6
       [cc] arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -Wall -ffunction-sections -g -Os -c -DSTM32F407VG -DSTM32F4XX -D__FPU_USED -DUSE_STDPERIPH_DRIVER -D__ASSEMBLY__ -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\Other -IC:\Users\daniel\Dropbox\stm32f4 -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\portable -IC:\Users\daniel\Dropbox -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\include -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot -IC:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\delay.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\kernelHeap.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\stm32f4_discovery_lcd.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\i2c.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\core.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\timer.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\utility.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_usart.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\task.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot\startup\startup_stm32f4xx.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\stm32f4_discovery.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\serviceReq.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_rcc.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\utils.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\mbox.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\mm.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\fonts.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_fsmc.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\time.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\event.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_gpio.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot\system_stm32f4xx.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\syscalls\syscalls.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\shell.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\portable\GCC\port.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\queue.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\mutex.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\flag.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_i2c.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\portable\arch.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\misc.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\sem.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\stm32f4_discovery_debug.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\CoOS\kernel\hook.c C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\usart.c
7
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
8
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.h:4,
9
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\delay.c:2:
10
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
11
       [cc] <command-line>:0:0: note: this is the location of the previous definition
12
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
13
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\stm32f4_discovery_lcd.c:45:
14
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
15
       [cc] <command-line>:0:0: note: this is the location of the previous definition
16
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
17
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.h:4,
18
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\i2c.c:2:
19
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
20
       [cc] <command-line>:0:0: note: this is the location of the previous definition
21
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
22
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\include/stm32f4xx_usart.h:32,
23
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_usart.c:85:
24
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
25
       [cc] <command-line>:0:0: note: this is the location of the previous definition
26
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
27
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\stm32f4_discovery.h:53,
28
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\stm32f4_discovery.c:45:
29
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
30
       [cc] <command-line>:0:0: note: this is the location of the previous definition
31
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
32
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.h:4,
33
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.c:27:
34
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
35
       [cc] <command-line>:0:0: note: this is the location of the previous definition
36
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
37
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\include/stm32f4xx_rcc.h:31,
38
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_rcc.c:56:
39
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
40
       [cc] <command-line>:0:0: note: this is the location of the previous definition
41
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
42
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.h:4,
43
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\utils.c:8:
44
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
45
       [cc] <command-line>:0:0: note: this is the location of the previous definition
46
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
47
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\include/stm32f4xx_fsmc.h:38,
48
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_fsmc.c:35:
49
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
50
       [cc] <command-line>:0:0: note: this is the location of the previous definition
51
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
52
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\include/stm32f4xx_gpio.h:32,
53
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_gpio.c:79:
54
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
55
       [cc] <command-line>:0:0: note: this is the location of the previous definition
56
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot\stm32f4xx.h:240:0,
57
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot\system_stm32f4xx.c:117:
58
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
59
       [cc] <command-line>:0:0: note: this is the location of the previous definition
60
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
61
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\syscalls\syscalls.c:10:
62
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
63
       [cc] <command-line>:0:0: note: this is the location of the previous definition
64
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
65
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.h:4,
66
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\shell.c:9:
67
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
68
       [cc] <command-line>:0:0: note: this is the location of the previous definition
69
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
70
       [cc] <command-line>:0:0: note: this is the location of the previous definition
71
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
72
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\stm32f4xx_i2c.c:87:
73
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\include/stm32f4xx_i2c.h:32,
74
       [cc]   at sun.net.www.http.HttpClient.openServer(Unknown Source)
75
       [cc]   at sun.net.www.http.HttpClient.openServer(Unknown Source)
76
       [cc]   at sun.net.www.http.HttpClient.<init>(Unknown Source)
77
       [cc]   at sun.net.www.http.HttpClient.New(Unknown Source)
78
       [cc]   at sun.net.www.http.HttpClient.New(Unknown Source)
79
       [cc]   at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
80
       [cc]   at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
81
       [cc]   at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
82
       [cc]   at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
83
       [cc]   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
84
       [cc]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
85
       [cc]   at java.lang.Thread.run(Unknown Source)
86
       [cc]   at sun.net.NetworkClient.doConnect(Unknown Source)
87
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
88
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\include/misc.h:32,
89
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_lib\source\misc.c:70:
90
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
91
       [cc] <command-line>:0:0: note: this is the location of the previous definition
92
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
93
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\stm32f4_discovery_debug.c:22:
94
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
95
       [cc] <command-line>:0:0: note: this is the location of the previous definition
96
       [cc] In file included from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis_boot/stm32f4xx.h:240:0,
97
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\main.h:4,
98
       [cc]                  from C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\usart.c:2:
99
       [cc] C:\Users\daniel\Dropbox\stm32f4\STM32F4_Discovery_CoOS\cmsis/core_cm4.h:135:0: warning: "__FPU_USED" redefined [enabled by default]
100
       [cc] <command-line>:0:0: note: this is the location of the previous definition
101
       [cc] Starting link
102
       [cc] arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -g -nostartfiles -Wl,-Map=STM32F4_Discovery_CoOS.map -Os -Wl,--gc-sections -LC:\CooCox\CoIDE\configuration\ProgramData\STM32F4_Discovery_CoOS -Wl,-TC:\CooCox\CoIDE\configuration\ProgramData\STM32F4_Discovery_CoOS/arm-gcc-link.ld -g -o STM32F4_Discovery_CoOS.elf ..\obj\delay.o ..\obj\kernelHeap.o ..\obj\stm32f4_discovery_lcd.o ..\obj\i2c.o ..\obj\core.o ..\obj\timer.o ..\obj\utility.o ..\obj\stm32f4xx_usart.o ..\obj\task.o ..\obj\startup_stm32f4xx.o ..\obj\stm32f4_discovery.o ..\obj\serviceReq.o ..\obj\main.o ..\obj\stm32f4xx_rcc.o ..\obj\utils.o ..\obj\mbox.o ..\obj\mm.o ..\obj\fonts.o ..\obj\stm32f4xx_fsmc.o ..\obj\time.o ..\obj\event.o ..\obj\stm32f4xx_gpio.o ..\obj\system_stm32f4xx.o ..\obj\syscalls.o ..\obj\shell.o ..\obj\port.o ..\obj\queue.o ..\obj\mutex.o ..\obj\flag.o ..\obj\stm32f4xx_i2c.o ..\obj\arch.o ..\obj\misc.o ..\obj\sem.o ..\obj\stm32f4_discovery_debug.o ..\obj\hook.o ..\obj\usart.o -L..\..\.. -lm
103
       [cc] ..\obj\fonts.o:(.data+0x0): multiple definition of `Font8x8'
104
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.data+0xc): first defined here
105
       [cc] ..\obj\fonts.o:(.data+0x8): multiple definition of `Font8x12'
106
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.data+0x14): first defined here
107
       [cc] ..\obj\fonts.o:(.data+0x10): multiple definition of `Font12x12'
108
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.data+0x1c): first defined here
109
       [cc] ..\obj\fonts.o:(.data+0x18): multiple definition of `Font16x24'
110
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.data+0x0): first defined here
111
       [cc] ..\obj\fonts.o:(.rodata+0x0): multiple definition of `ASCII8x8_Table'
112
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.rodata+0x0): first defined here
113
       [cc] ..\obj\fonts.o:(.rodata+0x600): multiple definition of `ASCII8x12_Table'
114
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.rodata+0x600): first defined here
115
       [cc] ..\obj\fonts.o:(.rodata+0xf00): multiple definition of `ASCII12x12_Table'
116
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.rodata+0xf00): first defined here
117
       [cc] ..\obj\fonts.o:(.rodata+0x1800): multiple definition of `ASCII16x24_Table'
118
       [cc] ..\obj\stm32f4_discovery_lcd.o:(.rodata+0x1800): first defined here
119
       [cc] collect2.exe: error: ld returned 1 exit status
120
121
BUILD FAILED
122
Total time: 8 seconds



Werde nicht wirklich daraus schlau was zu tun ist?
da ich ja eigentlich nur die stm32f4_discovery_lcd und fonts zum project 
hinzugefügt habe ...



aufjedenfall möchte ich an dieser stelle Danke für dein CoOS BSP sageN!

von Peter S. (psavr)


Lesenswert?

Ich kann es mir mal angucken. Ohne Code kann ich aber nix helfen, Du 
müsstest Deinen Code und/oder zumindest einen Link auf den Beispielcode 
von der ST-Homepage hier posten.

von holger (Gast)


Lesenswert?

>Werde nicht wirklich daraus schlau was zu tun ist?
>da ich ja eigentlich nur die stm32f4_discovery_lcd und fonts zum project
>hinzugefügt habe ...

>[cc] ..\obj\fonts.o:(.data+0x0): multiple definition of `Font8x8'

So etwas bekommt man wenn irgend ein Trottel sowas macht:

#include "fonts.c"

Nimm fonts.c aus deinem Projekt raus, bzw sorg dafür das es nicht
mit compiliert wird. Bei Eclipse geht das z.B. mit Exclude from build.

von Peter S. (psavr)


Lesenswert?

>#include "fonts.c"
>
>Nimm fonts.c aus deinem Projekt raus, bzw sorg dafür das es nicht
>mit compiliert wird. Bei Eclipse geht das z.B. mit Exclude from build.

Jedes *.c File soll zu einem Object-File (*.o) compiliert werden. Ein 
c-File sollte NIEMALS includiert werden.

Wenn eine Datei nicht eigenständig compiliert werden soll, dann benenne 
diese um, üblicherweise zu einem *.h File, oder sonst was (z.B. 
"fonts.def") und includiere diese in das *.c File wo es benötigt wird.
==> #include "fonts.h" oder #include "fonts.def"

Wen das Include-File nicht bloss Definitionen enthält, sondern auch 
Daten (Deklarationen, Code, Variabeln) dann solle diese Include-Datei 
bloss einmal im Projekt includiert werden, das #include sollte also in 
einem *.c File stehen und besser nicht in einem *.h File.

: Bearbeitet durch User
von Klaus Skibowski (Gast)


Lesenswert?

Zur Verteidigung des Posters sollte man dazu sagen, daß das so schon in 
den Originalbeispielen von ST ausgeliefert wird. Ich bin nämlich auch 
schon über das Thema gestolpert. Bis man dann mal da drauf kommt, daß 
die ein .c File inkludieren :-(

von geizhals (Gast)


Angehängte Dateien:

Lesenswert?

okeee
gut das war ein bisschen ein fail.. ich hab den fehler so behoben dass 
ich mehr oder weniger den inhalt von fonts.c und fonts.h in die lcd.c 
und lcd.h hinzugefügt habe .. ist jetzt hald ein wenig unübersichtlich 
geworden. aber mir ist es vorerst wichtig dass das teil läuft...

die lcd.c und lcd.h kommt von dem original beispiel von st...
allerdings funktionieren tut mal gar nix..
lcd bleibt weiß ...


die dateien hab ich angehängt...


im main habe ich nur den taskD verändert und die anderen task habe ich 
nicht starten lassen bzw. die led_init wird auch nicht ausgeführt.
1
void taskD(void* pdata)
2
{
3
4
//  STM32f4_Discovery_LCD_Init();
5
6
  uint16_t i=0;
7
  printf("LCD TASK: LCD initialized, Task started\n");
8
9
  while (1)
10
  {
11
/*
12
 *
13
 * void LCD_DrawFullRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
14
void LCD_DrawFullCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
15
 */
16
    LCD_DrawFullRect(1,1, 20,30);
17
    LCD_DrawFullCircle(40,43,50);
18
19
20
    LCD_RGB_Test();
21
    i++;
22
    printf("Board still running! TaskD - call: %d \n",i);
23
    CoTickDelay(50); //50 x 10ms = 500ms
24
  }
25
}


sowie die main function dazu:
1
  LCD_DeInit();
2
  STM32f4_Discovery_LCD_Init();
3
  LCD_RGB_Test();

von Peter S. (psavr)


Lesenswert?

Lass mal das ganze Projekt sehen, oder gib mal den Link auf den Code von 
ST an. (Habe keine Lust zu suchen)

Offebar möchtest Du die FPU verwenden?
"warning: "__FPU_USED" redefined [enabled by default]"
==> Versuche es erst mal ohne FPU

Langsam erhärtet sich auch mein Verdacht, das CoOS ein grobes Problem 
mit der Stack-Verwaltung hat und insbesondere (s)printf braucht offenbar 
schweinisch viel Stack.
==> Versuche es auch mal ohne OS.

Ich werde mich bei Gelegenheit nach einer RTOS Alternative umsehen, wer 
kann etwas empfehlen oder hat etwas, dass sich im "harten" Einsatz 
bewährt hat? (zuverlässig, einfach, klein, stabil)
==> ChibiOS?
==> FreeRTOS?

: Bearbeitet durch User
von geizhals (Gast)


Angehängte Dateien:

Lesenswert?

Hallo,

also eigentlich will ich nur die LCD von dem LCD beispiel des st 
beispiels verwenden und einbinden ..
FPU will ich nicht wirklich verwenden, wird wohl von dem beispiel so 
sein..

ok

ich stell mal das original beispiel hoch, ist allerdings ein keil 
projekt.
und mein versuch in dieses beispiel die lcd einzubinden.


in der zwischenzeit habe ich deinen rat befolgt und das lcd bsp in 
dieses bsp implementiert 
http://mikrocontroller.bplaced.net/wordpress/?page_id=113 allerdings tut 
sich noch immer nix .. LCD kaputt??

von Jörg B. (joerg-sh)


Lesenswert?

Du benutzt das embest board und das embest lcd ?

von geizhals (Gast)


Lesenswert?

genau! embest board und embest lcd!

LCD ist nicht kaputt, st bsp läuft!

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.