Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix HAL not properly initialized on F105x series#1310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fpistm merged 1 commit intostm32duino:masterfromttimasdf:fix-f105xc-startup
Mar 10, 2021

Conversation

@ttimasdf
Copy link
Contributor

Summary

This PR fixes the necessary initialization procedures which should be run before user code is called.

premain() function inmain.cpp is essential for the HAL library to initize properly, more specifically it calledHAL_Init which setup the systick interrupt handler which is necessary for writing a hello world.....

The issue#869 has already mentioned this bug but didn't find a solution to it. After some trials and errors and comparasion between assemblies for different products, the patch here is likely solving it.

If possible, is there's any chance we talk about this a bit further because I don't know why this workaround works in fact...

Validation

Demostration:

Detail step-by-step is To-Be-Filled. The following code is a modified blinking LED use loop basedmanual_delay() and HAL provideddelay() altogether. The originaldelay() would stuck if HAL_Init is not called beforehand, the same as described in#869.

/* * Blink * Turns on an LED on for one second, * then off for one second, repeatedly.*/#include<Arduino.h>#ifndef LED_BUILTIN  #defineLED_BUILTIN PD2#endifuint32_tmanual_delay(volatileuint32_t time) {volatileuint32_t factor =0xFF, i = time;while (factor >0) {while (i >0)  {      i -=1;    }    factor -=1;  }return time;}uint32_tblink(int pin,int times) {int i = times;while (i >0) {uint32_t delay =0xFFFF *4;// turn the LED on (HIGH is the voltage level)digitalWrite(LED_BUILTIN, HIGH);manual_delay(delay);// wait for a second// delay(1000);// turn the LED off by making the voltage LOWdigitalWrite(LED_BUILTIN, LOW);manual_delay(delay);// wait for a second// delay(1000);    i -=1;  }return i;}voidsetup(){// initialize LED digital pin as an output.pinMode(LED_BUILTIN, OUTPUT);}voidloop(){blink(LED_BUILTIN,10);delay(1000);}

Code formatting

  • Ensure AStyle check is passed thanks CI

Closing issues

Fixes#869

Copy link
Member

@fpistmfpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@fpistm
Copy link
Member

Hi@ttimasdf
Thanks for the PR.
Could you open an issue on the official repo:https://github.com/STMicroelectronics/STM32CubeF1/issues
or in thehttps://github.com/STMicroelectronics/cmsis_device_f1

This way you will get feedback from expert and this will allow to correct in the original repo.

@ttimasdf
Copy link
ContributorAuthor

Sure. All I know was that this part of the code belongs to HAL library, didn't realize the project is also on Github

fpistm reacted with thumbs up emoji

@jrahlf
Copy link

Why would you callSystemInit before__libc_init_array ?
Makes no sense to me.

@ttimasdf
Copy link
ContributorAuthor

Why would you callSystemInit before__libc_init_array ?
Makes no sense to me.

SystemInit just clears some registers and do not rely on any static objects, so called before__libc_init_array is quite safe.

Anddo a search in official repository you could find that they do it de facto on most of the other boards..

@fpistmfpistm added the fix 🩹Bug fix labelMar 9, 2021
@fpistmfpistm merged commit37470b5 intostm32duino:masterMar 10, 2021
@ttimasdfttimasdf deleted the fix-f105xc-startup branchMarch 24, 2022 15:52
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fpistmfpistmfpistm approved these changes

Assignees

No one assigned

Labels

fix 🩹Bug fix

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[New Variant] Can Filter with STM32F105RBT6

3 participants

@ttimasdf@fpistm@jrahlf

[8]ページ先頭

©2009-2025 Movatter.jp