打印
[STM8]

stm8s为啥就是编译不出来

[复制链接]
1986|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
黑色迷漫|  楼主 | 2015-7-9 09:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
#include "stm8s.h"

void GpioInit()
{
}

main()
{
        GpioInit();
        while (1);
}

错误
Compiling main.c...
cxstm8 -ic:\users\lyh2064416\desktop\stm8\stm8s007c8\stm8s_stdperiph_lib_v2.1.0\libraries\stm8s_stdperiph_driver\inc +debug -pxp -no -l +mods0 -pp -i"C:\Program Files (x86)\STMicroelectronics\CXSTM8_32K\Hstm8"  -clDebug\ -coDebug\ main.c
#error cpstm8 main.c:14(9) missing prototype
main.c:
The command: "cxstm8 -ic:\users\lyh2064416\desktop\stm8\stm8s007c8\stm8s_stdperiph_lib_v2.1.0\libraries\stm8s_stdperiph_driver\inc +debug -pxp -no -l +mods0 -pp -i"C:\Program Files (x86)\STMicroelectronics\CXSTM8_32K\Hstm8"  -clDebug\ -coDebug\ main.c " has failed, the returned value is: 1
exit code=1.

lcd1.elf - 2 error(s), 0 warning(s)
沙发
黑色迷漫|  楼主 | 2015-7-9 10:19 | 只看该作者
上面的问题解决了,,但是有一些warning,我不明白

使用特权

评论回复
板凳
黑色迷漫|  楼主 | 2015-7-9 10:20 | 只看该作者
#include        "STM8S.h"

#define                LED1        1<<1
#define                LED2        1<<2


/**********************************************************************************************************
**Function Name                                :        myDelay
**Descriptions                                :        软件延时
**Input         Parameters        :        Time:控制延时时间
**Output        Parameters        :        无
**Return        Value                                :        无
**********************************************************************************************************/
void myDelay(unsigned int Time)
{
        unsigned int i;
        while(Time--)
                for(i=0;i<500;i++);
}

/**********************************************************************************************************
**Function Name                                :        Gpio_Init
**Descriptions                                :        GPIO初始化:PC1、PC2设置为推挽输出
**Input         Parameters        :        无
**Output        Parameters        :        无
**Return        Value                                :        无
**********************************************************************************************************/
void GpioInit(void)
{
                GPIOC->DDR        |=         0x06;                                                                                                                                                //PC1、2设置为输出模式
                GPIOC->CR1        |=         0x06;                                                                                                                                                //PC1、2设置为推挽输出
                GPIOC->CR2        &=        ~(0x06);      value out of range

               
                GPIOC->ODR        |=        0x06;                                                                                                                                                //初始化为高电平
}

/*********************************************************************************************************
**Function Name                                :        main
**Descriptions                                :        2个流水灯,交替发亮
**Input         Parameters        :
**Output        Parameters        :
**Return        Value                                :
**********************************************************************************************************/
int main()
{
        //SystemInit();
        GpioInit();

        while (1)
        {
                GPIOC->ODR        &=        ~LED1;                                                                                                                                        //LED1亮                                                       
                GPIOC->ODR        |=         LED2;                                                                                                                                                //LED2灭                                               
                myDelay(100);
               
                GPIOC->ODR        |=        LED1;                                                                                                                                                //LED1灭                                                       
                GPIOC->ODR        &=        ~LED2;                                                                                                                                        //LED2亮
                myDelay(100);
               
        }
               
}

使用特权

评论回复
地板
amanda_s| | 2015-7-9 17:41 | 只看该作者
有错误才有进步!:0
没看见warning啊!

使用特权

评论回复
5
黑色迷漫|  楼主 | 2015-7-10 11:21 | 只看该作者
不能上传图片啊,,
我修改了project setting 让它显示error和warning

#warning cpstm8 main.c:32(22) value out of range
#warning cpstm8 main.c:51(17) value out of range
#warning cpstm8 main.c:56(17) value out of range
全是带~的行

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

11

帖子

0

粉丝