simpleOS 1.0

做了一个so simple的OS,本不好意思多说的。。。。不过还是说下吧。

首先,买不起开发板的我没有办完完成一件事,那就是保存任务上下文,因为这个过程实际上是将寄存器的值存放到任务堆栈中去的。

而要想实现,因为要访问寄存器,所以这个需要用到汇编代码,本机window显然没法模拟。

(有时间研究下Linux或者买个开发板看看能不能解决)

 

所以,最后的实现结果,实际上是每次选择优先级最高的任务去完成,这样就不存在抢占的问题了,不复杂。

大致为OSTaskCreate()创建任务,OSTaskDel()删除任务,OSSched()调度程序,OSTaskIdle()空闲任务,OSInit()操作系统初始化。

 

OSSched()选择优先级最高的任务,如何快速选择?uC/OS中的方法是个不错的选择:

http://www.cnblogs.com/gylei/archive/2012/05/31/2528776.html

 

好了剩下的就不复杂了,具体见代码吧:

View Code

 

转载于:https://www.cnblogs.com/zhazhalovecoding/p/5403932.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
详细解释一下这段代码,每一句都要进行注解:tgt = f'/kaggle/working/{dataset}-{scene}' # Generate a simple reconstruction with SIFT (https://en.wikipedia.org/wiki/Scale-invariant_feature_transform). if not os.path.isdir(tgt): os.makedirs(f'{tgt}/bundle') os.system(f'cp -r {src}/images {tgt}/images') database_path = f'{tgt}/database.db' sift_opt = pycolmap.SiftExtractionOptions() sift_opt.max_image_size = 1500 # Extract features at low resolution could significantly reduce the overall accuracy sift_opt.max_num_features = 8192 # Generally more features is better, even if behond a certain number it doesn't help incresing accuracy sift_opt.upright = True # rotation invariance device = 'cpu' t = time() pycolmap.extract_features(database_path, f'{tgt}/images', sift_options=sift_opt, verbose=True) print(len(os.listdir(f'{tgt}/images'))) print('TIMINGS --- Feature extraction', time() - t) t = time() matching_opt = pycolmap.SiftMatchingOptions() matching_opt.max_ratio = 0.85 # Ratio threshold significantly influence the performance of the feature extraction method. It varies depending on the local feature but also on the image type # matching_opt.max_distance = 0.7 matching_opt.cross_check = True matching_opt.max_error = 1.0 # The ransac error threshold could help to exclude less accurate tie points pycolmap.match_exhaustive(database_path, sift_options=matching_opt, device=device, verbose=True) print('TIMINGS --- Feature matching', time() - t) t = time() mapper_options = pycolmap.IncrementalMapperOptions() mapper_options.extract_colors = False mapper_options.min_model_size = 3 # Sometimes you want to impose the first image pair for initialize the incremental reconstruction mapper_options.init_image_id1 = -1 mapper_options.init_image_id2 = -1 # Choose which interior will be refined during BA mapper_options.ba_refine_focal_length = True mapper_options.ba_refine_principal_point = True mapper_options.ba_refine_extra_params = True maps = pycolmap.incremental_mapping(database_path=database_path, image_path=f'{tgt}/images', output_path=f'{tgt}/bundle', options=mapper_options) print('TIMINGS --- Mapping', time() - t)
05-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值