嵌入式复习题

最后一次考试了 小海螺预祝大家都能过!

简答题(7题考4题)

  1. 嵌入式系统的开发流程
    1. 系统需求分析
    2. 体系结构设计
    3. 硬件/软件协同设计
    4. 系统集成
    5. 完成测试并形成产品
  2. 中断处理的6个步骤
    1. 禁止其他中断
    2. 保存上下文
    3. 中断处理程序
    4. 中断服务程序
    5. 恢复上下文
    6. 允许新的中断
  3. Linux内核的5个功能
    1. 进程管理
    2. 内存管理
    3. 文件管理
    4. 设备控制
    5. 网络功能
  4. 常见的文件类型
    1. 普通文件类型
    2. 目录文件类型
    3. 块设备文件类型
    4. 字符设备类型
    5. 套接字文件类型
    6. 管道文件类型
    7. 链接文件类型。
  5. GCC编译的各个阶段及生成文件类型
    1. 预处理 (.c文件=>.i)
    2. 编译(.i文件=>.s)
    3. 汇编(.s文件=>.o)
    4. 链接(.o文件=>.elf/.out)
  6. 驱动程序编译进内核的一般步骤
    1. 创建Kconfig配置文件
    2. 编写编译驱动程序的Makefile文件
    3. 修改上层目录中的Kconfig和Makefile文件
    4. 运行内核配置界面menuconfig,生成编译内核的配置文件.config
    5. 运行内核源代码根目录下的Makefile或build文件,编译内核
  7. Linux中进程间通信方式有哪些
    1. 管道及有名管道
    2. 共享内存
    3. 消息队列
    4. 信号
    5. 信号量
    6. 套接字

程序分析和程序设计

  1. Makefile 文件程序 p77 题目不固定 放两个例题

    1. 例题:Makefile给出main.c、mytool1.h、mytool1.c、mytool2.h、mytool2.c的依赖关系
    main:main.o  mytool1.o  mytool2.o
    	gcc  -o  main  main.o  mytool1.o  mytool2.o
    main.o:main.c
    	gcc  -c  main.c
    mytool1.o:mytool1.c  mytool1.h
    	gcc  -c  mytool1.c
    mytool2.o:mytool2.c  mytool2.h
    	gcc  -c  mytool2.c
    
    1. 例题:
    sum:ex_sum.o   mysum.o
       gcc  ex_sum.o  mysum.o  -o sum
    ex_sum.o:  ex_sum.c
       gcc  -c  ex_sum.c
    mysum.o:  mysum.c  mysum.h
       gcc  -c  mysum.c
    
  2. shell脚本程序(整除) p86

    1. 例题:编写显示20以内能被3整除的数的shell脚本程序

      #! /bin/bash
      for((i=1;i<20;i++))
      do
      	if(( i% 3 == 0 ))
      	then
      		echo $ i
      	fi
      done
      
  3. 同时控制两个LED灯的点亮或熄灭的程序 p93-94

    volatile unsigned int *GPC0CON=(volatile unsigned int *) 0xE0200060;
    volatile unsigned int *GPC0DAT=(volatile unsigned int *) 0xE0200064;
    void delay()
    {
    int k=0x100000;
    while (k--);
    }
    int main(void)
    {
    int i=0;
    *GPC0CON &= ~0xff000;
    *GPC0CON |=0x11000;
    while (1)
    {
    *GPC0DAT &= ~(3<<3);
    *GPC0DAT |=i<<3;
    i++;
    if(i==4){i=0;}
    delay();
    }
    return 0;
    }
    
  4. 文件的创建和读写程序 p121 例6-2 6-3

#include<fcntl.h>
#include<string.h>
#include<stdio.h>
Int mian()
{
Int fd;
fd=open("b.txt",O_CREAT|O_TRUNC|O_RDWR,0666);
printf(("create_file:b.txtfd=%d\n",fd);
char *buf="this is a embedded course!";
int len=strien(buf);
int size=write(fd,buf,len);
lseek(fd,0,SEEK_SET);
char buf1[50];
int size1=read(fd,buf1,50);
printf("size1=%d,b.txt context are:%s\n",size1,buf1);
close(fd);
return0;
}
  1. 管道程序、父进程向管道写入字符串、子进程从管道中读取字符串 p131改题
#include<stdio.h>
#include<stdlib.h>
int main()
{
int x,fd[2];
char buf[50],s[50];
pipe(fd);
x=fork();
if(x==0)
{
close(fd[1]);
sleep(1);
read(fd[0],s,sizeof(s));
printf(“read string:%s\n”,s);
close(fd[0]);
exit(0);
}
else if(x>0)
{
close(fd[0]);
sprintf (buf,”this is an another pipe!);
write(fd[1],buf,sizeof(buf));
close(fd[1]);
wait(x,NULL,0);
exit(0);
}
}
  1. 建立从共享内存中读取数据的进程程序 p134 例6-13
#include<stdio.h>
#include<sys/shm.h>
int main(int argc,char * argv[])
{
	int shm_id;						
	char * shm_buf,str[50];			
	shm_id = atoi(argv[1]);		
	shm_buf = shmat(shm_id,0,0)	
	printf("读取共享内存数据:\n");
	sprintf(str,shm_buf);			
	printf("%s \n",str);
	system("ipcs -m");				
}
  1. 解除进程到共享内存的映射,并释放内存空间的程序 p135 例6-14
#include<stdio.h>
#include<sys/shm.h>
int main(int argc,char * argv[])
{
	int shm_id;						
	char * shm_buf;			
	shm_id = atoi(argv[1]);				
	shm_buf = shmat(shm_id,0,0)
	shmdt(shm_buf);					
	shmctl(shm_id,IPC_RMID,NULL);		
	system("ipcs -m");					
}
  • 10
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值