-
Notifications
You must be signed in to change notification settings - Fork 129
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK fixes for BL702 (EFUSE, USB, ADC, etc.) #145
Open
mdednev
wants to merge
18
commits into
bouffalolab:master
Choose a base branch
from
mdednev:bl702-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b6199b2
Fix CLIC register sizes
ae8f6e5
Add callback for low-level initialization before SystemInit
53c0ef8
Add required functions to get current clock settings
fe0e015
Fix compilation warning
b0fd101
Use GLB_Set_System_CLK_Div ROM implementation if BFLB_USE_ROM_DRIVER …
4d8363c
Fix compilation warnings
46f5981
Fix EFUSE API functions to use proper EFUSE value addresses and
e559bfd
Fix invalid double inclusion definition macro
95e5934
Implement proper I2C bus NAK condition handling for unresponsive devices
1dfb247
Add missing ADC clock divider definition
725478b
Fix bflb_adc_channel_config() function prototype and correct maximum …
153ba83
Fix compilation warnings
c03f725
Massive reworks of EP0 control transactions handling to improve stabi…
597077a
Add support for GET_REPORT HID requests with lengths greater than 1 b…
fc313fe
Fix for GPIO9...GPI13 and GPIO23...GPI28 parameters initialization: p…
d6c2771
Corrected cycle ranges to get all CLIC registers initialized.
638ded6
Restricted GLB_GPIO_USE_PSRAM__IO_OFFSET_ADDR processing only for BL7…
ba2efc7
Fix using register value instead of it's address.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint8_t is incorrect because with
for (i = 0; i < (IRQn_LAST + 3) / 4; i++)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From e24 RISC-V core description:
registers are 1B width and address is computed as
CLIC Hart Base + 1 × Interrupt ID
, but as I see now the/4
devision should be removed. So cycle should befor (i = 0; i < IRQn_LAST; i++)
. I've missed this while making a patch.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use uint32_t to make it quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint32_t usage is incorrect, cause it will produce 4B aligned addresses while accessing pointer as array. CLIC registers are byte aligned, not word aligned and so their pointer type should be
uint8_t *
. Please look at provided figures.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdednev CLIC_INTIE_OFFSET and CLIC_INTIP_OFFSET are both 4 byte aligned. the number of registers is evenly divisible by 4. they're all being set to 0 anyway.
As long as the cpu supports writing 32bit values here the original code should do the correct thing, right?
Is there something else here that we're not seeing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is right.
It depends on implementation and it isn't true in general. In other words this is error-prone way. So I've suggested more general and error-proof initialization code. Yes, it is little-bit slower, but it is more correct and matches e24 core registers description (1B registers should be accessed as 1B and not as 4B). For example SDK IRQ driver uses 1B accesses to this registers (drivers/lhal/src/bflb_irq.c):
Yes, this code works, but if it will be reused for future MCUs it could lead to errors in initialization.