Skip to content
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

为复旦微电子FM33LC0XX添加BSP。包含UART驱动,已经在板子上测试通过。 #4957

Merged
merged 6 commits into from
Sep 2, 2021

Conversation

jqj96
Copy link
Contributor

@jqj96 jqj96 commented Aug 20, 2021

拉取/合并请求描述:(PR description)

[
为复旦微电子FM33LC0XX添加BSP。
包含UART驱动,已经在板子上测试通过。
STM32系列BSP修改移植,驱动文件没有删除,后续继续修改。
]

以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in the submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use a web browser to visit PR, and check items one by one, and ticked them if no problem.

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 本拉取/合并请求代码是高质量的 Code in this PR is of high quality
  • 本拉取/合并符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@CLAassistant
Copy link

CLAassistant commented Aug 20, 2021

CLA assistant check
All committers have signed the CLA.

@mysterywolf
Copy link
Member

请签署CLA协议

FL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}


Copy link
Contributor

Choose a reason for hiding this comment

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

代码格式不正确:
1.函数名小写
2.空行不可超过一行
3.缩进使用空格
可以查阅:https://gitee.com/rtthread/rt-thread/blob/gitee_master/documentation/coding_style_cn.md
可以使用astyle进行格式化

Copy link
Contributor Author

Choose a reason for hiding this comment

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

格式我看一下,那个函数是调用的官方库函数,是大写的,这个还改吗。

rt_thread_mdelay(500);
}

// return RT_EOK;
Copy link
Contributor

Choose a reason for hiding this comment

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

代码格式:
删除无用注释

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

#ifdef __cplusplus
extern "C" {
#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

main.h没用的话直接删掉吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/

Copy link
Contributor

Choose a reason for hiding this comment

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

license:非apache 的兼容 license,需要更新 bsp 目录下的 license 声明:Copyright_Notice.md。bsp按照字母顺序排列。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我看一下

#endif
};

struct stm32_adc
Copy link
Contributor

Choose a reason for hiding this comment

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

stm32 ?


/* attention !!! baud calculation example: Tclk / ((ss + bs1 + bs2) * brp) 36 / ((1 + 8 + 3) * 3) = 1MHz*/
#if defined (SOC_SERIES_STM32F1)/* APB1 36MHz(max) */
static const struct stm32_baud_rate_tab can_baud_rate_tab[] =
Copy link
Contributor

Choose a reason for hiding this comment

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

SOC_SERIES_STM32F1 ?
stm32 ?


#if defined(SOC_SERIES_STM32F0)
ADC_ChanConf.SamplingTime = ADC_SAMPLETIME_71CYCLES_5;
#elif defined(SOC_SERIES_STM32F1)
Copy link
Contributor

Choose a reason for hiding this comment

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

SOC_SERIES_STM32F1 ?

return -RT_ERROR;
}

#if defined(SOC_SERIES_STM32MP1) || defined (SOC_SERIES_STM32H7) || defined (SOC_SERIES_STM32WB)
Copy link
Contributor

Choose a reason for hiding this comment

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

这部分只作为你们芯片自己的驱动,不用考虑和stm32兼容

Copy link
Contributor Author

Choose a reason for hiding this comment

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

驱动拿STM32修改的,只修改了串口,其他的没删掉,以后方便接着添加,那我先删掉吗

Copy link
Contributor

Choose a reason for hiding this comment

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

你们的代码不需要在stm32上跑,删掉就行。然后命名也可以改一下,不然看着蛮奇怪的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

那我先删掉吧,不在STM32上跑,就是驱动部分drv_xxx.c是拿stm32的drv_xxx.c驱动改的,现在只改了串口,没改的还是stm32那一部分的。还有库函数的函数名大写,这个不用修改了吧。

/* SysTick configuration */
void rt_hw_systick_init(void)
{
SystemCoreClockUpdate();
Copy link
Contributor

Choose a reason for hiding this comment

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

格式:缩进问题

.reset = _crypto_reset,
};

int stm32_hw_crypto_device_init(void)
Copy link
Contributor

Choose a reason for hiding this comment

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

函数名

#ifndef __DRV_CRYPTO_H__
#define __DRV_CRYPTO_H__

int l4_hw_crypto_device_init(void);
Copy link
Contributor

Choose a reason for hiding this comment

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

这个应该写错了

};

struct stm32_dac
{
Copy link
Contributor

Choose a reason for hiding this comment

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

修改所有stm32相关的变量名和函数名

/* debug option */
//#define ETH_RX_DUMP
//#define ETH_TX_DUMP
//#define DRV_DEBUG
Copy link
Contributor

@yangjie11 yangjie11 Aug 24, 2021

Choose a reason for hiding this comment

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

这些如果是可选项,可以放进menuconfig。不需要则删除

extern void phy_reset(void);
/* EMAC initialization function */
static rt_err_t rt_stm32_eth_init(rt_device_t dev)
{
Copy link
Contributor

@yangjie11 yangjie11 Aug 24, 2021

Choose a reason for hiding this comment

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

驱动中的函数,不要使用 rt_ 开头。
内部函数建议改成:_stm32_uart_xxx 这类方式。如 _eth_init(),以下也全部做出修改 :
rt_stm32_eth_init;
rt_stm32_eth_open;
rt_stm32_eth_close;
rt_stm32_eth_read;
rt_stm32_eth_write;
rt_stm32_eth_control;
rt_stm32_eth_rx;
rt_stm32_eth_tx;

int stm32_flash_read(rt_uint32_t addr, rt_uint8_t *buf, size_t size);
int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size);
int stm32_flash_erase(rt_uint32_t addr, size_t size);

Copy link
Contributor

@yangjie11 yangjie11 Aug 24, 2021

Choose a reason for hiding this comment

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

修改命名

#elif defined(GPIOB)
#define __STM32_PORT_MAX 2u
#elif defined(GPIOA)
#define __STM32_PORT_MAX 1u
Copy link
Contributor

Choose a reason for hiding this comment

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

修改命名

stm32_pin_dettach_irq,
stm32_pin_irq_enable,
stm32_pin_get,
};
Copy link
Contributor

@yangjie11 yangjie11 Aug 24, 2021

Choose a reason for hiding this comment

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

修改ops函数名 如 _pin_mode

@yangjie11
Copy link
Contributor

  1. drv_usart.c中。注释需要改为英文,并使用 /* xx */ 格式放在语句上边或者右边
  2. 文件头的处理,建议最好将 Change Logs 修改一下

@mysterywolf
Copy link
Member

中文可以不用改英文,这个芯片海外应该还没有使用的,建议国产芯片优先服务国内开发者。别给中国开发者制造困难不说,结果该bsp海外还没几个非中文母语者使用😂,犯不上。

@mysterywolf
Copy link
Member

mysterywolf commented Aug 31, 2021

建议国产芯片的bsp注释规范应该和全球通用bsp(如STM32)区别开,除非确认该芯片厂商提供的芯片datesheet以及开发指南有完整的英文支持,并且存在海外市场和海外开发者,否则应该采用中文作为注释。否则,增加英文注释不再是为了交流方便,而是给中国开发者制造困难。因为在实际过程中我们发现:
非母语是英语的开发者虽然可以采用英语注释,但是英语的描述在母语为英语的开发者看来,虽然大部分能看懂,但是读起来非常的怪异,不符合本土阅读习惯。这种感觉类似于这个:
1_Switch-Health_Instructions_Simplified_Chinese.pdf
能读懂,但是读起来非常的奇怪。

@Guozhanxin Guozhanxin added the +1 Agree +1 label Sep 1, 2021
@mysterywolf mysterywolf added the +2 Agree +2 label Sep 1, 2021
@BernardXiong
Copy link
Member

Please fix the conflicting .ignore_format.yml file, thank you.

@BernardXiong BernardXiong added the fix_for_conflicting Please fix conflicting files. label Sep 2, 2021
@mysterywolf mysterywolf removed the fix_for_conflicting Please fix conflicting files. label Sep 2, 2021
@mysterywolf
Copy link
Member

完蛋 估计等那边的pr合并了 又得冲突 现在有两个pr在提交扫描忽略文件,要是再冲突您还得改一次🤣

@Guozhanxin
Copy link
Member

完蛋 估计等那边的pr合并了 又得冲突 现在有两个pr在提交扫描忽略文件,要是再冲突您还得改一次🤣

这个忽略文件可以加在自己的bsp下面,可以像scons一样支持分布式的。

@jqj96
Copy link
Contributor Author

jqj96 commented Sep 2, 2021

完蛋 估计等那边的pr合并了 又得冲突 现在有两个pr在提交扫描忽略文件,要是再冲突您还得改一次🤣

无限套娃,哈哈

@yangjie11
Copy link
Contributor

都加到自己的bsp下吧。。

@mysterywolf
Copy link
Member

都加到自己的bsp下吧。。

是的 感觉这部分应该调整一下,大家都学着之前BSP的样子往一个文件里塞确实有些不方便,后续提交bsp应该有个这方面的提示 @Guozhanxin

@yangjie11
Copy link
Contributor

弄个 bsp 模板出来

@Guozhanxin
Copy link
Member

棒👍

@Guozhanxin Guozhanxin merged commit dca7dcb into RT-Thread:master Sep 2, 2021
@Guozhanxin
Copy link
Member

RT-Thread Commiter,您好!我们计划在本月15日(即2021.10.15)发布v4.0.4版本,希望您这两天可以对您维护的BSP进行一些测试工作!以保证在RT-Thread的发布版本里当前 BSP 的各项功能是好用的!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
+1 Agree +1 +2 Agree +2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants