Skip to content

Conversation

@leon6002
Copy link

This PR added support for Semidrive's E3650 platform.

The related PR:
bao-project/bao-demos#75

Copy link
Member

@danielRep danielRep left a comment

Choose a reason for hiding this comment

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

The PR is already in a good state for approval. There is, however, an issue with ` e3650_enable_imp_def: these type of core implementation-defined configurations should be done in a different manner. We discussed a possible solution for these cases in our weekly meeting. We'll try to introduce the necessary infrastructure for this in the following days. I'll tag this PR as soon as that PR is introduced.

Please solve also the issues with gitlint (commit sign-off) and the code needs to be format using make format


/* Enable Prefetch */
/* mrrc p15, 0, r0, r1, c15 : read AxCACHE PREFETCH CONTROL REGISTER */
__asm__ volatile("mrrc p15, 0, %0, %1, c15" : "=r"(lo), "=r"(hi));
Copy link
Member

Choose a reason for hiding this comment

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

We use the macros SYSREG_GEN_ACCESSORS* to generate the appropriate accessors for system registers. Please modify accordingly throughout e3650_enable_imp_def

Copy link
Author

Choose a reason for hiding this comment

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

I have refactored the system register access using the SYSREG_GEN_ACCESSORS macros as suggested. I've also verified the changes on the actual hardware, and the platform behaves as expected. Please let me know if the current implementation aligns with the project's standards.

Comment on lines 37 to 40
hi &= ~3U; /* Clear bit 0,1 */
lo &= ~(7U << 13);
/* CONFIG_DATA_PREFETCH_OT = 5 */
lo |= (1U << 11) | (5U << 13);
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid using magical numbers and switch for macros.

Copy link
Author

Choose a reason for hiding this comment

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

I have replaced the magic numbers with macros as suggested.

/* Enable Branch Prediction */
val = 0;
__asm__ volatile("mcr p15, 1, %0, c9, c1, 1" :: "r"(val));
__asm__ volatile("isb");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
__asm__ volatile("isb");
ISB();

Copy link
Author

Choose a reason for hiding this comment

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

Refactored as suggested.

val = (ICACHE_FLASH_2_AXIM_2 | DCACHE_FLASH_2_AXIM_2);
__asm__ volatile("mcr p15, 1, %0, c9, c1, 0" :: "r"(val));

__asm__ volatile("isb");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
__asm__ volatile("isb");
ISB();

Copy link
Author

Choose a reason for hiding this comment

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

Refactored as suggested.

## Copyright (c) Bao Project and Contributors. All rights reserved.

boards-objs-y+=e3650_desc.o
boards-objs-y+=e3650.o
Copy link
Member

Choose a reason for hiding this comment

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

e3650.c should be named platform.c to keep consistency. We're using that naming for the source file containing the definition of void platform_default_init(void)

Copy link
Author

Choose a reason for hiding this comment

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

Renamed e3650.c to platform.c as suggested. Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

I have also formatted the code using make format as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants