Support for STM32F730 Value line MCUs Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

tecnologic
Posts: 119
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

Support for STM32F730 Value line MCUs

Postby tecnologic » Fri Dec 20, 2019 9:29 pm

Hi All,

i'm currently porting chibios to STM32F730x8 series. I needed to update the stm header files and created a linker script but when i boot the code i'm immediately struck at _port_switch. which is kind of strange because the call stack says its coming from the first line in the Reset_Handler: b _crt0_entry. I susspect there is some general error either in the code or the linkage.

i attached my changes as a patch but for reference the original code is here: UNIMOC Code
Attachments
patch1.zip
(2.28 MiB) Downloaded 28 times

tecnologic
Posts: 119
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

Re: Support for STM32F730 Value line MCUs

Postby tecnologic » Fri Dec 20, 2019 10:01 pm

Its always this vector: VectorF8() at vectors.S:1,021 0x200332

strange thing. if i run the f722 demo i dont have the issue. Ideas?

Thanks.

User avatar
Giovanni
Site Admin
Posts: 13125
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: Support for STM32F730 Value line MCUs

Postby Giovanni » Sat Dec 21, 2019 6:34 am

Is the device really flashed?

Giovanni

tecnologic
Posts: 119
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

Re: Support for STM32F730 Value line MCUs

Postby tecnologic » Sat Dec 21, 2019 4:18 pm

Hi Giovanni,

yes i'm quite sure it is flashed. When i build the F722ZI Demo i just copy the elf file to the spot of my projects elf file and start the debugger with the same settings. I had a look at stm32_regitsty.h and everything seems to work as expected. I get the j-link download progressbars every time i switch elf files. And verify flash is on as well.

I know i missed some thing in the port but i have no idea whats the problem. The linker script is fine because i changed the demo to use that. I even change the board.h of the demo to define STM32F730xx instead of STM32F722xx. But i cant break the demo. So there must be something wrong with my code and not the port?

tecnologic
Posts: 119
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

Re: Support for STM32F730 Value line MCUs

Postby tecnologic » Sat Dec 21, 2019 4:38 pm

Update:

It was my code. The port is WORKING!. If u need any thing more than the patch please ask.

Alex

tecnologic
Posts: 119
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

Re: Support for STM32F730 Value line MCUs

Postby tecnologic » Sat Dec 21, 2019 5:59 pm

I found the issue with my code. If i use the cpp wrappers and define a thread that overrides the pure virtual main function of the BaseStaticThread class. I have the issue. This look to me more like a compiler problem or does any one have a idea whats happening?

The code is as simple as that:

Code: Select all

#include "ch.hpp"
#include "hal.h"

using namespace chibios_rt;

/* Reference to the server thread.*/
static ThreadReference sref;

/*
 * LED blink sequences.
 * NOTE: Sequences must always be terminated by a GOTO instruction.
 * NOTE: The sequencer language could be easily improved but this is outside
 *       the scope of this demo.
 */
#define SLEEP           0
#define GOTO            1
#define STOP            2
#define BITCLEAR        3
#define BITSET          4
#define MESSAGE         5

typedef struct {
   uint8_t       action;
   union {
      msg_t       msg;
      uint32_t    value;
      ioline_t    line;
   };
} seqop_t;

// Flashing sequence for LED3.
static const seqop_t LED3_sequence[] =
{
      {BITSET,      LINE_LED_RUN},
      {SLEEP,       800},
      {BITCLEAR,    LINE_LED_RUN},
      {SLEEP,       200},
      {GOTO,        0}
};

// Flashing sequence for LED4.
static const seqop_t LED4_sequence[] =
{
      {BITSET,      LINE_LED_MODE},
      {SLEEP,       600},
      {BITCLEAR,    LINE_LED_MODE},
      {SLEEP,       400},
      {GOTO,        0}
};

// Flashing sequence for LED5.
static const seqop_t LED5_sequence[] =
{
      {BITSET,      LINE_LED_ERROR},
      {SLEEP,       400},
      {BITCLEAR,    LINE_LED_ERROR},
      {SLEEP,       600},
      {GOTO,        0}
};

// Flashing sequence for LED6.
static const seqop_t LED6_sequence[] =
{
      {BITSET,      LINE_LED_PWM},
      {SLEEP,       200},
      {BITCLEAR,    LINE_LED_PWM},
      {SLEEP,       800},
      {GOTO,        0}
};


/*
 * Sequencer thread class. It can drive LEDs or other output pins.
 * Any sequencer is just an instance of this class, all the details are
 * totally encapsulated and hidden to the application level.
 */
class SequencerThread : public BaseStaticThread<128>
{
private:
   const seqop_t *base, *curr;                   // Thread local variables.

protected:
   void main(void) override {

      setName("sequencer");

      while (true) {
         switch(curr->action) {
         case SLEEP:
            sleep(TIME_MS2I(curr->value));
            break;
         case GOTO:
            curr = &base[curr->value];
            continue;
         case STOP:
            return;
         case BITCLEAR:
            palClearLine(curr->line);
            break;
         case BITSET:
            palSetLine(curr->line);
            break;
         }
         curr++;
      }
   }

public:
   SequencerThread(const seqop_t *sequence) : BaseStaticThread<128>() {

      base = curr = sequence;
   }
};



/* Static threads instances.*/
static SequencerThread blinker1(LED3_sequence);
static SequencerThread blinker2(LED4_sequence);
static SequencerThread blinker3(LED5_sequence);
static SequencerThread blinker4(LED6_sequence);

/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  System::init();

 
  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    BaseThread::sleep(TIME_MS2I(500));
  }
}



Thanks

User avatar
Giovanni
Site Admin
Posts: 13125
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: Support for STM32F730 Value line MCUs

Postby Giovanni » Sat Dec 21, 2019 6:06 pm

A 27MB patch?

Giovanni

tecnologic
Posts: 119
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

Re: Support for STM32F730 Value line MCUs

Postby tecnologic » Sat Dec 21, 2019 10:31 pm

Hi Giovanni,

my bad, i updated all the STM32 headers these make the patch so huge. I seperated the changes, so please find attached the real changes to the os code without the ST headers in os/common/ext/st.

Alex
Attachments
patch_f730_without_st_headers.7z
(2.22 KiB) Downloaded 34 times

User avatar
alex31
Posts: 304
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 28 times
Been thanked: 37 times
Contact:

Re: Support for STM32F730 Value line MCUs

Postby alex31 » Mon Dec 23, 2019 11:04 am

tecnologic wrote:I found the issue with my code. If i use the cpp wrappers and define a thread that overrides the pure virtual main function of the BaseStaticThread class. I have the issue. This look to me more like a compiler problem or does any one have a idea whats happening?

Thanks


Hello,
perhaps a static C++ object initialisation problem ?
do you link with g++ ?

Alexandre

steved
Posts: 734
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 10 times
Been thanked: 109 times

Re: Support for STM32F730 Value line MCUs  Topic is solved

Postby steved » Mon Dec 23, 2019 12:23 pm

There was a bug in the scatter files which caused problems linking static classes (IIRC); might be a similar problem here. It's fixed in trunk, but not in the standard 19.1.3 distribution.

Check os\common\startup\ARMCMx\compilers\GCC\ld\rules_Code.ld - line 38 or thereabouts should say:

Code: Select all

    .text : ALIGN_WITH_INPUT


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 7 guests