Author Topic: STM32 uTaskerBoot Project  (Read 5334 times)

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
STM32 uTaskerBoot Project
« on: November 23, 2021, 03:03:05 PM »
Hello Mark,
   I download the STM32 package from its GIT repository (V1.4.11)  which in uTasker-Kinetic-master/Applications/uTaskerBoot/ only have the project file for for Kinetis, but don't have project file for SMT32. And in the uTaskerSerialBoot folder & uTaskerV1.4 folder have project file for both Kinetis & SMT32.
    Is this  uTaskerBoot support for STM32? If yes, where I can get the project file for this STM32 uTaskerBoot?
    Thanks.
    Tee 

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: STM32 uTaskerBoot Project
« Reply #1 on: November 27, 2021, 03:34:56 AM »
Hi

I just checked in some changes that add "STM32 BM Loader target" to the VisualStudio project (VS2019) and also a GCC make file build that can be started from the VS project (when STM32 + GCC Build target is selected).

Both Kinetis and STM32 targets built successfully in the simulator and cross-compiled to their binary images.

There are only a few actual STM32 HW targets in config.h but it is relatively easy to add new ones if needed.

Regards

Mark

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #2 on: November 29, 2021, 11:52:08 AM »
Hi Mark,
    Thanks for your reply. Could you please create the project for IAR which I'm using IAR for this STM32 uTaskerBoot.
    Thanks & best regards.
     Tee

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: STM32 uTaskerBoot Project
« Reply #3 on: November 29, 2021, 05:12:28 PM »
Hi

I have checked in an IAR9 project for STM32.

Regards

Mark

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #4 on: November 30, 2021, 02:12:33 PM »
Hi Mark,
   Successful compile the project using IAR9.2.
   Thanks.
    Tee

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #5 on: December 10, 2021, 10:36:25 AM »
Hi Mark,
    I try to use uTaskerCombine tool to combine the uTaskerBoot.bin (from uTaskerBoot Project) with uTakserBM.bin (from uTaskerV1.4 Project) as below: (STM32)

   uTaskerCombine uTaskerboot.bin uTaskerBM.bin 0x1000 STM32.bin STM32.out 0x80000000

and 

   uTaskerCombine uTaskerboot.bin uTaskerBM.bin 0x1000 STM32.bin

but both command only generated STM32.bin file with 0 byte size.


    I attached both file for your reference & testing. Please advice how to generate the .out format file that required by IAR to program the firmware into the STM32 MCU.
    I am using Window 7 Professional (64bit) & uTaskerCombine V1.6 .

     Thanks.
     Tee
     
       
   

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: STM32 uTaskerBoot Project
« Reply #6 on: December 12, 2021, 11:03:16 PM »
Hi

When this command is executed there is the message "Boot code too long (> 1000). Terminating" and so no output content is generated.
The problem is that the "uTaskerBoot.bin" is 50k in size and the command tried to add the second file "uTaskerBM.bin" at the location 0x1000, which is not possible since this would be in the middle of the first file.

The basic issue is that the boot loader is being built with a linker script that locates the reset vector at the 0x08000000 but he reset of the code at 0x080c000 and so leaves a large gap between the two which makes the file large (this can be seen by opening the binary file in a hex editor and shows a large amount of 0x00 being inserted).

I believe the line in the linker script doing this is:

define symbol __ICFEDIT_region_CODE_start__ = 0x0800c000;

and is designed for use by programs that leave two flash sectors free for use by the parameter system. Since the boot loader doesn't use the parameter system this line is not appropriate and if you remove it it will presumably then generate loader code that is all in the first flash sector (and small).


The IAR out format is ELF format, which is not generated. You will therefore need to use a different loading technique than IAR's (which only allows loading files that it has created). ST Micro has a utility that is often used for this and, once the loader and the initial application are installed subsequent uploads can be performed by the application's loading method.

Regards

Mark


Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #7 on: December 14, 2021, 03:24:23 PM »
Hi Mark,
    Thanks for your clarification.

    By using Segger J-Flash, I manage to combine the both file & program on the MCU. But it still not working.
    After that by using IAR, I try to debug on the uTaskerBoot which I found two problem on (uTaskerBootLoader.c):

1)   The firmware never run the " start_application(UTASKER_CODE_START) " when compile for STM32, so I add defined _SMT32  as
       as below for the compiler.


#elif defined _STM32 || defined _HW_AVR32 || defined _RX6XX || defined _KINETIS || defined _LM3SXXXX || defined _LPC17XX || (defined _M5223X && (defined _GNU || defined _COMPILE_IAR)) // {14}{17}{19}{20}{21}
    #if !defined _WINDOWS
    start_application(UTASKER_CODE_START);                               // jump to the application
    #endif
#endif


2) when the program run  [ if (fnCheckNewCode(&file_header))], it will cause HardFault exception
    static void irq_hard_fault(void)
   {
    }
   I attached the print screen (IAR) for your reference.

   When I change the routine as below,

static int fnCheckNewCode(UPLOAD_HEADER *file_header)
{
    return 0;
   
}
      After compile again & combine both file (uTaskserBM and uTaskerBoot), my board success boot up and running my program.
   
      Please advice how to solve the problem for fnCheckNewCode(UPLOAD_HEADER *file_header) routine.
     
      For your information, I am using SMT32F407ZET6 .
      Thanks & best regards.
   
       Tee
     
   

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: STM32 uTaskerBoot Project
« Reply #8 on: December 26, 2021, 02:07:55 AM »
Hi

I am sorry that i didn't respond earlier:

1. I also found that the jump was not enabled for STM32 and the new dependency is correct.

2. I don't see the code causing the hard fault but I assume that it is due to the routine checking the flash content at an incorrect address/range (if you look at the call stack you can see the routine that resulted in the error - and also if you single step out of the hard fault handler (in disassembly mode) it will return to the instruction causing the error. You can see what address the instruction is using and verify that the range set up for the check is suitable for the part in question (like uFILE_START and UTASKER_APP_START).

Regards

Mark

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #9 on: December 28, 2021, 07:35:59 AM »
Hi Mark,
    Thanks for your reply.
    I already found the problem which cause the firmware halt (when call this function fnCheckNewCode(&file_header)). Basically it cause by stack overflow, and it can be solved by increase the stack size (in .lcf file)

define symbol __ICFEDIT_size_cstack__ = 0x400;
    Thanks.
    Tee

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: STM32 uTaskerBoot Project
« Reply #10 on: December 28, 2021, 07:38:50 PM »
Hi

That is strange since the project uses a stack pointer at the top of SRAM and not the stack size that is given in the linker script file (this allows its stack to automatically have the size of all unused RAM).
Possibly it is the specific IAR version overwriting this?

Regards

Mark

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #11 on: November 16, 2022, 03:02:12 AM »
Hi Mark,
    For this project I need to use the ADC & Interrupt, which I enable

#define SUPPORT_ADC      (in app_hw_stm32.h file)

and


       #define IRQ_TEST                                                 // test IRQ port interrupts
     (in Port_Interrupts.h file)

But same error during compiling the project.

Updating build tree...
application.c 
Error[Pe020]: identifier "INTERRUPT_LEVEL_1" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\Port_Interrupts.h 466
Error[Pe020]: identifier "IRQ_BOTH_EDGES" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\Port_Interrupts.h 468
Error[Pe020]: identifier "INTERRUPT_LEVEL_4" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\Port_Interrupts.h 471
Error[Pe020]: identifier "INTERRUPT_LEVEL_5" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\Port_Interrupts.h 477
Error[Pe020]: identifier "INTERRUPT_LEVEL_7" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\Port_Interrupts.h 483
Error[Pe020]: identifier "test_nmi_7" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\Port_Interrupts.h 484
Error[Pe020]: identifier "IRQ11_INTERRUPT_PRIORITY" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\Port_Interrupts.h 489
Error[Pe136]: struct "stADC_INTERRUPT_RESULT" (declared at line 8340 of "F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\ F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\ADC_Timers.h 653
../../Hardware/STM32/STM32.h") has no field "ucADC_flags"
Error[Pe020]: identifier "ADC_ERR_PRIORITY" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\ADC_Timers.h 851
Error[Pe020]: identifier "ADC_SINGLE_ENDED" is undefined F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\ADC_Timers.h 857
Error[Pe136]: struct "stADC_SETUP" (declared at line 8358 of "F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\ F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\ADC_Timers.h 860
../../Hardware/STM32/STM32.h") has no field "int_adc_speed"
Warning[Pe223]: function "ADC_SAMPLING_SPEED" declared implicitly F:\Utasker\uTasker-Kinetis-master\Applications\uTaskerV1.4\ADC_Timers.h 860
Error while running C/C++ Compiler
arp.c 

     Just want check with you, this STM32 project is not ready for ADC & port interrupt function?
     Please advice.
     Thanks.
     Tee

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #12 on: November 18, 2022, 06:05:43 AM »
Hi Mark,
    Another question, I saw you mention about the open source version (currently I am using this version) and professional version. What is the different between those two version? Will the professional version support all the ADC & external port interrupt function, and how can I get this professional version?
    Thanks.
   

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: STM32 uTaskerBoot Project
« Reply #13 on: November 28, 2022, 02:04:16 AM »
Hi

The open source project supports the ADC and port interrupts but the reference application didn't include the STM32 interface (instead it was using a Coldfire one, which generated the errors).
I just checked in new versions of
ADC_Timers.h
and
Port_Interrupts.h
which includes the STM32 interface.


The open source version is freely and anonymously available (supporting Kinetis and STM32) but is several years behind the development state of the professional version and doesn't include things like security, or WiFi support, for example. It is also not supported - apart from some bug fixes and occasional updates.

The professional project version is a supported version with much extended functionality and continuous development of features. It is not intended for hobby use and is licensed in professional product developments:
Licensing is detailed at https://www.utasker.com/Licensing/License.html
Prices are detailed at https://www.utasker.com/Licensing/Prices.html
and licenses are purchased at https://www.utasker.com/Payment/Payment.html
which are either single product (3 months of personal support and access to the development repo.) or full (any number of products and 12 months support and access).

Regards

Mark

Offline TeeYi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: STM32 uTaskerBoot Project
« Reply #14 on: November 29, 2022, 05:19:31 AM »
Hi Mark,
    Thanks for your reply.
     So if I pay for the license fee, I can get the professional version for STM32 with ADC & external interrupt feature with reference application? If  yes, how can I proceed for here?
     Thanks.