-
Couldn't load subscription status.
- Fork 8.1k
soc: egis_et171: update config and resolve issue of ram func #97960
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,2 @@ | ||
| # Copyright (c) 2025 Egis Technology Inc. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| | ||
| DT_CHOSEN_Z_FLASH := zephyr,flash | ||
| | ||
| config FLASH_LOAD_SIZE | ||
| default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_FLASH)) |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| | @@ -7,8 +7,16 @@ | |||||||||
| #include <zephyr/init.h> | ||||||||||
| #include <zephyr/kernel.h> | ||||||||||
| | ||||||||||
| void soc_early_init_hook(void) | ||||||||||
| __weak void soc_early_init_hook(void) | ||||||||||
| { | ||||||||||
| #if CONFIG_XIP && CONFIG_ICACHE | ||||||||||
| /* Since caching is enabled before z_data_copy(), RAM functions may still be cached | ||||||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it named 'arch_data_copy' now. | ||||||||||
| * in the d-cache instead of being written to SRAM. In this case, the i-cache will | ||||||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what section from the linker is the relevant here, because, normally this should only copy data over? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ramfunc section is also copied through this function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't we then do it in kernel/xip.c and use the cache api and implement the icache driver for riscv processors with the Zifencei extention? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the Otherwise, we must abandon the implementation in reset.S and fully implement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for now we can leave it here, but in the long therm we should move over to the cache api There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
arch/riscv/custom/andes/reset.S enables I/D Cache for SoC using Andes Custom CSR, which speeds up the boot sequence. I don't prefer to remove this. I think the main problem is that the RAM function copy operation doesn’t handle I/D-cache synchronization right now. Lines 31 to 34 in b677e82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you create a general issue for that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @jackylee-go for the feedback. I am ok with this fix too. | ||||||||||
| * fetch the wrong content from SRAM. Thus, using "fence.i" to fix it. | ||||||||||
| */ | ||||||||||
| __asm__ volatile("fence.i" ::: "memory"); | ||||||||||
| #endif | ||||||||||
| | ||||||||||
| /* AHB ~200Mhz / 3 = 66MHz AHB , ~66Mhz / 2 / 2 = 18Mhz APB */ | ||||||||||
| sys_write32(0x01 | 0x20 | 0x02, 0xF0100004U); | ||||||||||
| | ||||||||||
| | ||||||||||
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.
What feature needs to be overridden instead of application appending the initialization via SYS_INIT()?
Uh oh!
There was an error while loading. Please reload this page.
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.
Currently, not all drivers for this SOC are completed.
For example, setting the root clock is implemented in 'soc_early_init_hook'.
Therefore, if you want to change the clock, you must override soc_early_init_hook.
Changing the root clock at runtime using SYS_INIT() can pose some risks.
(Zephyr does not expect clocks to be changed at runtime.)
Uh oh!
There was an error while loading. Please reload this page.
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.
Currently, other drivers that haven't issue a PR have been completed and verified as modules.
However, some implementations require to modify 'soc_early_init_hook', which will cause conflicts when using upstream to verify.
Add a 'weak' declaration can avoid those conflicts.
Uh oh!
There was an error while loading. Please reload this page.
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.
The clock requirement should be solved by implement a clock driver or add Egis Kconfig option to set the clock.
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.
@andyross @peter-mitsis for comment on making
soc_early_init_hookweakThere 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.
No other vendor has a weak symbol for these and late/early soc hooks are used 174 times in zephyr, if you need it or have these issues I would say your drivers or system setup is badly architected or misdesigned
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.
This is why I emphasize that not all drivers for this SOC are fully implemented.
This declaration is added solely to facilitate smoother development of subsequent drivers.
If the relevant driver has already been developed, this declaration can be removed.
If this approach is not appropriate for upstream , please let me know.
I’ll try to find an alternative solution.
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.
this basically reiterates why this soc should never have been added upstream
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 SYS_INIT with INIT_LEVEL_EARLY, thats even happening before soc_early_init_hook or use board_early_init_hook , that is directly after soc_early_init_hook
In general if you are developing drivers, that you plan to contribute work in-tree
Uh oh!
There was an error while loading. Please reload this page.
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.
My point is that this isn't a order issue of 'SYS_INIT'.
It's that there might be different implementations that conflict with each other.
But based on the current upstream content, even if there is a conflict, there won't be any problem.